A useful perl command line skeleton
Dan Coutu
coutu at snowy-owl.com
Tue Jun 10 15:58:22 EDT 2003
Morbus Iff wrote:
> >As a follow-on to my talk about Perl last month I thought I'd put
> >together a handy code framework that is very useful for creating command
> >line or cron based utilities.
>
> See also: http://sial.org/code/perl/scripts/blank.pl.html
>
Thanks for sharing the pointer!
> >#!/usr/bin/perl -w
>
> If you're looking for crossplatform fun,
> "use warnings" is more portable than the -w.
Good to know, I never tried using perl for other than experiments on
Windows.
>
> ># Basic verbosity shows at least the program version to the user.
> ># By comparing for verbosity > some value each bit of output
> ># can be fine tuned into different verbosity levels.
> >print "myprogram version $VERSION\n" if $Verbose > 0;
>
> If you use $0 here, you can save yourself some editing.
>
>
True, but only in the main code body itself. Once you get into the data
section after the __END__ indicator this no longer works. So you can't
use it in the pod text to auto-substitute the program name there.
--
Dan Coutu
Managing Director
Snowy Owl Internet Consulting, LLC
http://www.snowy-owl.com/
More information about the gnhlug-discuss
mailing list