Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Use POD to document your tool, follow the guidelines of manpages; include at least the following sections: NAME, SYNOPSIS, DESCRIPTION, AUTHOR. Once you have proper POD you can generate a man page with pod2man, view the documentation at the console with perldoc your-script.pl.</p> <p>Use a module that handles command line options for you. I really like using <a href="http://search.cpan.org/perldoc?Getopt::Long" rel="noreferrer">Getopt::Long</a> in conjunction with <a href="http://search.cpan.org/perldoc?Pod::Usage" rel="noreferrer">Pod::Usage</a> this way invoking --help will display a nice help message.</p> <p>Make sure that your scripts returns a proper exit value if it was successful or not.</p> <p>Here's a small skeleton of a script that does all of these:</p> <pre><code>#!/usr/bin/perl =head1 NAME simplee - simple program =head1 SYNOPSIS simple [OPTION]... FILE... -v, --verbose use verbose mode --help print this help message Where I&lt;FILE&gt; is a file name. Examples: simple /etc/passwd /dev/null =head1 DESCRIPTION This is as simple program. =head1 AUTHOR Me. =cut use strict; use warnings; use Getopt::Long qw(:config auto_help); use Pod::Usage; exit main(); sub main { # Argument parsing my $verbose; GetOptions( 'verbose' =&gt; \$verbose, ) or pod2usage(1); pod2usage(1) unless @ARGV; my (@files) = @ARGV; foreach my $file (@files) { if (-e $file) { printf "File $file exists\n" if $verbose; } else { print "File $file doesn't exist\n"; } } return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload