Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Structure of Perl CGI code

by one4k4 (Hermit)
on Oct 30, 2001 at 23:52 UTC ( [id://122182]=note: print w/replies, xml ) Need Help??


in reply to Structure of Perl CGI code

This is quick, and just my $0.02, but..

I like the concept of modes.
Think /cgi-bin/script.pl?mode=order

Then, you can do many things..
Create a hash with references to subroutines, and..
my %mode_hash = (order => \&mode_order, confirm =>\&mode_confirm); my $mode = param('mode') || "order"; #default mode &{$mode_hash{$mode}}; # executes the mode subroutine
I know there is more than one way to call the subroutine in the mode hash, but like I said, this is just spilled out from memory.

Anyway, that scales here at work. We have a similar approach, using mod_perl and Apache. The intranet here is huge, and it seems to provide (the dev team, at least) with understood and managable code....

_14k4 - perlmonks@poorheart.com (www.poorheart.com)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-25 21:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found