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