jeff.sadowski Posted July 24, 2007 Share Posted July 24, 2007 (edited) Ok after getting perl working in IIS now I have a more difficult task. I have a perl script that works in linux that just isn't working in windows.Here is the script#!c:\perl\bin\perl.exeuse WWW::Mechanize;my $m = WWW::Mechanize->new();my $someimage="imagelocation.jpg";$m->get($someimage);my $data = $m->content;my $contenttype=$m->ct;print "Content-type: " . $contenttype . "\n\n";print $data;I installed www::mechanize using activeperl's configuration If anyone wants steps I'll post them. Its pretty easy though.Anyways when I point to my script the image is all messed up.Like I said this script works flawlessly in linux.My next step is to try out the cygwin version of perl and see if that fixes things.I'll have to install the www::mechanize for it too. For it I think I have to use the cpan install methodAh ha further testing shows it to be activeperl.I slightly modified my script to not print the Content stuff and tested it on the commandlinelike so "./image.pl > image.jpg"using Active perl the image is messed upusing cygwin's perl its A OKso now I need to figure out how to use cygwin's perl in IIS.It was easy enough I just had to change the 2 places I mentioned from c:\perl\bin\perl.exe to c:\cygwin\bin\perl.exeBut I learned I didn't even have to do that.by default activeperl prints \r\n for all \n to prevent this I have to tell it to print in binarymodeso I added the line binmode(stdout);before the print lines and everything works good. Edited July 25, 2007 by jeff.sadowski Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now