Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 romping around the Monastery: (4)
As of 2014-09-21 00:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (165 votes), past polls