[Za-pm] Re: perldoc

Sean Carte scarte at pan.uzulu.ac.za
Thu Jun 5 07:40:52 CDT 2003


On Thu, 2003-06-05 at 14:15, Spike wrote:
> Anybody got this to work yet?
> 
> 
> At 2003/06/04 03:34 PM, Sean Carte wrote:
> > > if ( $ARGV[0] eq '--help' ) {
> > >     exec('perldoc', $0);
> > > }

What do you mean? I'm using it already.

My scripts now look like this:

#!/usr/bin/perl -w

=head1 NAME

test_script.pl

=head1 SYNOPSIS

  blah

=head1 DESCRIPTION

This is a test

=head1 DATE

20030605

=cut

if ( $ARGV[0] and ( $ARGV[0] eq '--help' ) ) {
  exec('perldoc', $0);
}

use strict;

print 'one, two, three ...', "\n";

exit 0;
__END__

Calling them normally works:
[seanc at seanc scripts]$ perl test_script.pl
one, two, three ...

and calling them with --test works too:
[seanc at seanc scripts]$ perl test_script.pl --help

TEST_SCRIPT(1)        User Contributed Perl Documentation       TEST_SCRIPT(1)

NAME
       test_script.pl

SYNOPSIS
       blah

DESCRIPTION
       This is a test

DATE
       20030605

perl v5.8.0                       2003‐06‐05                    TEST_SCRIPT(1)
/tmp/zcqzxjqbCN (END)

Some of my scripts do a little more than that though, but you get the
idea ...
-- 
Regards
Sean Carte

University of Zululand
Network Services Unit
Phone: 035 902 6081
Fax: 035 902 6028

"La di di, one two three, it's Eric the half a bee..."




More information about the Za-pm mailing list