Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Should I use CGI3 for my first CGI program?

by bikeNomad (Priest)
on Jul 27, 2001 at 00:59 UTC ( [id://100149]=perlquestion: print w/replies, xml ) Need Help??

bikeNomad has asked for the wisdom of the Perl Monks concerning the following question:

I'm about to write my first set of CGI programs. I've got some very light form work to do, and some minimal HTML generation. This needs to be light from a memory and CPU standpoint, as it's going into a slow embedded system with a relatively small amount of RAM. I've already written the graphics-generating bits using GD and Chart::Plot (and they're not exactly blindingly fast), but now I need to add some moderately dynamic forms.

I note that Lincoln Stein has CGI version 3.03 or so on CPAN along with 2.753. Right now I have 2.752 loaded in one system. He says that version 3 is faster. Does this mean that it will require less memory as well on my system? I don't know whether I should try the version 3 in an attempt to ease the life of my little embedded system or should go with version 2, which is tried and true.

Note that this is not a "web site", nor is it particularly high traffic. I suspect that it'll get on the order of a few hits per day (most of the time it won't even be connected to anything with a display or browser). I just have to make sure that I don't start swapping too hard when it does get a hit (this is battery powered), and that responses come back reasonably fast.

I'm running a web server (httpi) that's based on Perl (demand loaded from xinetd). This is clever enough to just do a require on executable Perl programs, rather than doing the ugly CGI thing. Perl will be running all the time anyhow for data collection, so Perl itself will be at least partially shared.

Any feel for which CGI I should use? Or should I not bother? All I really need is query parsing and URL (un)escaping (I think); the HTML generation doesn't look terribly useful for me.

Note that security is not an issue here, as the device never has its web server connected to the Internet (satellite time is too expensive for that).

  • Comment on Should I use CGI3 for my first CGI program?

Replies are listed 'Best First'.
(Ovid) Re: Should I use CGI3 for my first CGI program?
by Ovid (Cardinal) on Jul 27, 2001 at 02:29 UTC

    Since your concern is this being light in terms of both memory and CPU usage, why not use CGI::Lite? It will handle the query parsing and has URL encode and decode methods. It's much smaller than CGI.pm (something like 27K instead of 200+K).

    Cheers,
    Ovid

    Vote for paco!

    Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Re: Should I use CGI3 for my first CGI program?
by LD2 (Curate) on Jul 27, 2001 at 02:50 UTC
    Ovid makes an excellent point. Also, awhile back on the discussion of A serious problem with CGI.pm 3.01 - $code_or_die mentions from the readme docs that version 3.* is in alpha state..it may be faster, but it's not quite stable. I'd say if you use it, it's at your own risk.
Re: Should I use CGI3 for my first CGI program?
by shotgunefx (Parson) on Jul 27, 2001 at 03:59 UTC
    Just a thought, I tried out CGI3 briefly and utilizing it made an existing script coredump with a deep recursion error.
    BETA Beware.

    -Lee

    "To be civilized is to deny one's nature."
Re: Should I use CGI3 for my first CGI program?
by synapse0 (Pilgrim) on Jul 27, 2001 at 05:47 UTC
    I haven't really benchmarked it, but I've heard that using CGI from an OO standpoint is less intensive than importing the functions.. how true is this? what are the implications? I use CGI as an object simply cause objects seem easier to use, but i've not done much testing on the difference.. actually I've never used CGI as non-OO..
    -Syn0

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://100149]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2024-04-23 19:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found