Link to home
Start Free TrialLog in
Avatar of kesea
kesea

asked on

Perl -> PerlEx problem

Hi experts,

The code below works fine with Perl (if I name the script .cgi), but as soon as I move it to use PerlEx instead (name the script .plex) it stops working -- it never goes into the while loop.  I am using strict and $tmpPathorig is set to something like c:\images\image.jpg, and $bytesread, $size, and $data are declared like "my $size;" at the beginning of the script.  

Any idea what I can do to make it work with PerlEx?

Thanks,
kesea

open(OUT,">$tmpPathorig");
binmode OUT;
while($bytesread=read ($imageFileArg,$data,1024))
{
       $size+=$bytesread;
       print OUT $data;
}  
close(OUT);
Avatar of ronan_40060
ronan_40060
Flag of United States of America image

HI Kesea
What web server are u using ? Apache or IIS ?
Avatar of kandura
kandura

Hi kesea,

What's in $imageFileArg? Is it initialized properly at the start of your script? Is it a valid filehandle?

As a quick fix, I suggest you put everything you have now within a subroutine, and call that from the start of the script.

Let me know if that alters the result.

HTH,
Kandura

Ronan: PerlEx is a Windows only perl accelerator similar to mod_perl. It runs on IIS and supposedly also on Netscape's webserver.
Avatar of Tintin
What errors/symptoms do you get running it under PerlEx?
Avatar of kesea

ASKER

It turns out it is actually due to ImageMagick not working with PerlEx.  From what I have read on the internet, they don't go together.  If anyone knows any different let me know.  Or if you know any other ways to resize images without using ImageMagick and that you know works with PerlEx.

kesea
I happen to have ImageMagick running fine with PerlEx. Which versions are you using (Perl, PerlEx, ImageMagick, IIS)?
Avatar of kesea

ASKER

Hi kandura,

Glad to hear you have it working!

My versions are:

Perl : 5.8.0
IIS : whatever comes with Windows 2000 Server
PerlEx : the trial version 2.3.1
ImageMagick : 5.5.7--Q16

How are you liking PerlEx?  How long have you had it running for?  My main concern with PerlEx is how it compares to something like Java which is multithreaded.  Do you think PerlEx is suitable for an application/website where there are theoretically tens of thousands of users on all at once, trying to access the same scripts as others at the same time?  I know perlex is much faster than perl but does it still have its limits?  Your thoughts on this would be much appreciated.  

kesea
ASKER CERTIFIED SOLUTION
Avatar of kandura
kandura

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kesea

ASKER

That seems to be what I'm experiencing as well with PerlEx -- instability, and a lot of monitoring is involved.  I have also had things crash to the point that I've had to restart the server to get it working again.  That is something I want to avoid -- being instable at heavy loads.  I'd rather solve this problem now, and get a solution going while I'm smaller, than when I'm growing.

Is mod_perl multithreaded?  What do you think about converting to Java?

I won't be able to try setting the environment variable and path until tonite, I'll let you know how it goes.

Thanks very much, this is very helpful.

kesea

mod_perl 2.0 is multithreaded.
I'm using the older mod_perl with Apache 1.3 on linux, and there every instance is a separate process.
I'm currently looking at converting my windows apps to apache 2.0/mod_perl 2.0 on Windows (don't want to change too much in one go), and that runs smoothly. I do have the feeling that the Apache/Linux combination is faster though.
I also know that you shouldn't think of using Apache 1.3 on Windows, because it's a single thread and as such only capable of one request at a time.

I'm not going to suggest you convert to Java. In my opinion, it's the wrong language for the job. It depends on how your shop is organized of course, but unless you are very proficient in Java, or have several programmers more versed in Java than in Perl, I would strongly recommend you stick with Perl. I have programmed a lot in Java in the past, but am very happy with Perl. Especially once you settle on a well established application framework, development in Perl is so much faster and more stable. My framework consists (among others) of CGI::Application with CGI::Session, HTML::Template and Class::DBI, and that makes for very rapid development with very little code.
Avatar of kesea

ASKER

Hmm apache 2.0/mod_perl 2.0 sounds like a good way to go. I really like Perl and really didnt want to switch to Java.  What is involved in converting scripts from Perl/PerlEx to mod_perl?  Anything?  Why are you switching from Linux to Windows?  Just curious.
If your scripts behave well under PerlEx, there's probably nothing you need to change for mod_perl.

I'm actually moving away from Windows :-)
We started out on Windows 2000 server, but new applications are started on Debian Linux.
Avatar of kesea

ASKER

Thanks so much for the conversation it has been very informative.  If I have any questions about the conversion if I decide 100% to go that way (I have to do a bit more research) I'll start a new question with new points :)  But I'll post a note here about it so that the new question gets your attention :)  
okido, and good luck :)
Kandura is one of the all time best Perl experts I have ever seen :)
HI Ronan, I'm flattered, but really I'm just another perl consumer ;)