Jump to content

perl interpreters


Recommended Posts

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.exe

use 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 method

Ah ha further testing shows it to be activeperl.

I slightly modified my script to not print the Content stuff and tested it on the commandline

like so "./image.pl > image.jpg"

using Active perl the image is messed up

using cygwin's perl its A OK

so 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.exe

But 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 binarymode

so I added the line

binmode(stdout);

before the print lines and everything works good.

Edited by jeff.sadowski
Link to comment
Share on other sites


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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...