#!/usr/bin/perl -w use strict; use warnings; =head1 NAME Example - short description =cut use constant VERSION => '0.0.1'; use diagnostics; use Getopt::Long qw(:config no_ignore_case posix_default ); use Pod::Usage; =head1 SYNOPSIS Example -run -help|-h -man -version [...] =cut my %opt = (); GetOptions( \%opt, 'run!', 'help|h!', 'man!', 'version!', ) or pod2usage( -verbose => 0, -exitval => 1, -output => \*STDERR ); =head1 OPTIONS =over 4 =item B<-help|-h> Print a brief help message and exit. =cut if ( defined $opt{help} ) { pod2usage( -verbose => 1, -exitval => 0 ); } =item B<-man> Prints the manual page and exit. =cut if ( defined $opt{man} ) { pod2usage(-verbose => 2, -exitval => 0); } =item B<-version> Prints the version number and exit. =cut if ( defined $opt{version} ) { print 'Example version ' . VERSION . "\n"; exit 0; } =item B<-run> This option is running your program. =cut unless ( defined( $opt{run} )) { pod2usage(-verbose => 0, -exitval => 1); } =back =cut # # # # print "Program is running.\n" # # # # __END__ =head1 DESCRIPTION B<Example > will do something... =head1 AUTHOR Urs Stotz <stotz@gmx.ch> =head1 COPYRIGHT Copyright (c) 2005, Urs Stotz <stotz@gmx.ch> All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO L<perl(1)|perl> =cut