in reply to RFC: newscript.pl , my very first script!
Overall, it looks fine. Here are some suggestions, though:
First, you have a _usage() function that'll give help on the program. You may want to use POD for your documentation, and have your usage message be brief and refer the user to run perldoc newscript.pl to see full documentation.
The second thing I'd suggest is to use 'heredocs' for your script templates. That way, they're easier to edit correctly and get the way you want them to be, something like:
print NEWSCRIPT <<EOPerlTpl; #!/usr/bin/perl # $name # use warnings; use strict; EOPerlTpl
My final suggestion is to have a couple tags you can use to add clusters of frequently-used modules. As an example, I was often asked to generate reports from our database, and they normally would want the report in a spreadsheet. So I'd code it so that if it recognized "RPT" as a module, that I'd automatically add:
use DBI; use Spreadsheet::WriteExcel; use Spreadsheet::WriteExcel::Styler; my ($DBName, $DBUID, $DBPWD) = ("MyDatabase", "reportAccount", "tehRpt +P@55werd"); . . . add a few lines here to define my favorite excel styles . . .
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: RFC: newscript.pl , my very first script!
by Darfoune (Novice) on Jul 24, 2015 at 21:32 UTC | |
by roboticus (Chancellor) on Jul 24, 2015 at 21:42 UTC | |
by Darfoune (Novice) on Jul 25, 2015 at 14:27 UTC |