Solved

Perl -> PerlEx problem

Posted on 2004-08-14
15
381 Views
Last Modified: 2008-03-10
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);
0
Comment
Question by:kesea
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 2
  • +1
15 Comments
 
LVL 9

Expert Comment

by:ronan_40060
ID: 11802009
HI Kesea
What web server are u using ? Apache or IIS ?
0
 
LVL 18

Expert Comment

by:kandura
ID: 11805835
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.
0
 
LVL 48

Expert Comment

by:Tintin
ID: 11806061
What errors/symptoms do you get running it under PerlEx?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:kesea
ID: 11806597
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
0
 
LVL 18

Expert Comment

by:kandura
ID: 11808494
I happen to have ImageMagick running fine with PerlEx. Which versions are you using (Perl, PerlEx, ImageMagick, IIS)?
0
 

Author Comment

by:kesea
ID: 11810523
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
0
 
LVL 18

Accepted Solution

by:
kandura earned 500 total points
ID: 11811029
I've been running PerlEx since around 1999 I think.
I'm still at activeperl 5.6 though, and did have some difficulty getting ImageMagick to work properly.
I had to set this environment variable for the system, as well as adding that dir to the PATH variable:
    MAGICK_HOME=D:\Perl\site\lib\auto\Image\Magick

As for my satisfaction with PerlEx, it has been waning gradually over time. It is not very stable under heavy load, to the extent that it collapses completely instead of just blocking excess requests.
Memory consumption somehow increases over time to rather spectacular amounts.
I have several large applications running under PerlEx, and the server needs careful monitoring.
Reloading the apps is also prone to failures: sometimes I need to reset the entire IIS several times before the sites come back up.

If you have the possibility, I would advise you to switch to Apache with mod_perl. Back in 1998 I didn't know about it, and we were a Windows only shop at the time, so PerlEx was a great solution. Over the years I've become much more experienced, and mod_perl is definitely preferable IMO. And these days, it's easy to set up, easy to maintain, extremely stable and very good at what it does.
0
 

Author Comment

by:kesea
ID: 11811386
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

0
 
LVL 18

Expert Comment

by:kandura
ID: 11811615
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.
0
 

Author Comment

by:kesea
ID: 11812939
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.
0
 
LVL 18

Expert Comment

by:kandura
ID: 11813782
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.
0
 

Author Comment

by:kesea
ID: 11814001
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 :)  
0
 
LVL 18

Expert Comment

by:kandura
ID: 11814033
okido, and good luck :)
0
 
LVL 9

Expert Comment

by:ronan_40060
ID: 11814081
Kandura is one of the all time best Perl experts I have ever seen :)
0
 
LVL 18

Expert Comment

by:kandura
ID: 11815029
HI Ronan, I'm flattered, but really I'm just another perl consumer ;)
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question