Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: avoiding excessive number of methods in CGI::Application and DBI modules

by Tanktalus (Canon)
on May 01, 2005 at 18:05 UTC ( #453059=note: print w/ replies, xml ) Need Help??


in reply to Re: avoiding excessive number of methods in CGI::Application and DBI modules
in thread avoiding excessive number of methods in CGI::Application and DBI modules

That's fine if you want a bunch of different .cgi scripts. But, if you want them all in the same script for some reason, perl gives you lots of rope to do this with.

sub setup { my $self = shift; for my $table in (@tables) { # define @tables elsewhere $self->run_modes( "c_$table" => sub { $self->do_c($table); }, "r_$table" => sub { $self->do_r($table); }, "u_$table" => sub { $self->do_u($table); }, "d_$table" => sub { $self->do_d($table); }, ); } }
Different .cgi scripts is great when you're giving your C::A-based module to others to use, as it provides some simple flexibility to the middle-man. But, I'm not so fond of it for general use. They actually confuse me. Maybe I'm easily confused about this, I suppose. Either way, this is just another WTDI.


Comment on Re^2: avoiding excessive number of methods in CGI::Application and DBI modules
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2015-07-08 01:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls