Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Good Style for Small Apps

by superfrink (Curate)
on Jun 22, 2015 at 17:51 UTC ( [id://1131509]=note: print w/replies, xml ) Need Help??


in reply to Good Style for Small Apps

Instead of multiple scripts to add, remove, update records generally I would write one script that uses command line arguments (eg: Getopt::Long) and a "dispatch table". eg:
sub add { print "added\n"; } sub remove { print "removed\n"; } my $dt = { 'add' => \&add , 'remove' => \&remove }; my $cmd = "add"; if (defined $dt->{$cmd}) { $dt->{$cmd}(); } else { print "command not found: ", $cmd, "\n"; }

Replies are listed 'Best First'.
Re^2: Good Style for Small Apps
by Anonymous Monk on Jun 22, 2015 at 18:00 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2024-04-23 08:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found