Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Review of my script

by space_monk (Chaplain)
on May 15, 2013 at 13:01 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-24 03:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found