in reply to Re: Perl cgi without mod_perl, your experience
in thread Perl cgi without mod_perl, your experience

Thanks, Seumas!

I'm rewriting my code so in an OO way bit by bit so that I can eventually use mod_perl.
From my understanding, plain perl code will run with mod_perl. No? I thought all that mattered was making sure that you don't have globals?
  • Comment on Re^2: Perl cgi without mod_perl, your experience

Replies are listed 'Best First'.
Re^3: Perl cgi without mod_perl, your experience
by elwarren (Priest) on Jun 22, 2004 at 16:16 UTC
    It doesn't need to be OO, but as you progress you'll find it's much easier to build modules out of your code and then use them in your applications.

    You are correct about globals, programming under mod_perl is what finally got me into the habit of using my.

    Saying what everyone else has said in a different way:
    Since you're running on Windows, remember that you're going to be loading and unloading perl.exe and the perlxx.dll for every request. This can begin to fragment your memory over time. XP reclaims memory much better than NT did, neither as well as a *nix will. Consider a thousand requests coming in, each loading an interpreter and parsing a script, each with a footprint of between 2mb and 10mb each. This can eat up memory very quickly.

    I suggest opening up task manager and adding the mem usage, vm size, and peak mem usage columns to the processes page. Then try to fire up 10 (or as many as you can) connections to your script and watch the processes come in and out. It's a real simple and fast way to see how that's going to scale. I think somebody posted a simple stress test here before, you could easily do it with a quick POE script as well.

Re^3: Perl cgi without mod_perl, your experience
by Seumas (Curate) on Jun 22, 2004 at 16:11 UTC
    Since your code is persistant under mod_perl, you just want to make sure that it's clean code so it isn't necessary to write your stuff in an OO way.

    Really, you want to write clean code - whether or not you're using mod_perl. If it's clean, you'll be able to move to mod_perl later if you want/need/can.

    Unfortunately, in my case, I'm re-writing a system I wrote from scratch when I was first picking up the language so it's kind of messy.