Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Review of my script

by space_monk (Chaplain)
on May 15, 2013 at 13:01 UTC ( #1033679=note: print w/replies, xml ) Need Help??

in reply to Review of my script

Firstly congratulations on being a neat and organised developer.

Apart from the issues mentioned in other comments, if you are developing a module or even a script, consider tacking a POD description at the end of it. Its the easiest way of providing documentation on what your script does and how it works.

Please try to limit the use of "global" parameters. Your MySQL and Postgres routines should be passed all the data they need to work as parameters instead of picking up globals like @args.yes i know variables declared with my have local scope in the enclosing block, but in this case there is no enclosing block

You should perhaps have a hash mapping the routine to the engine

Something like:

my %engineMap = ( 'mysql' => \&mysql, 'postgres' => \&postgres ); if ($engineMap{$engine}) { $engineMap{$engine}->(@args); } else { print "Unknown database engine\n"; showUsage(); }
If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1033679]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2018-06-25 10:37 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.