utility modules that you should know about
DESCRIPTION
This slideshow was presented at Frozen Perl 2008 and covers a small portion of CPAN that any Perl programmer should be familiar with.TRANSCRIPT
![Page 1: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/1.jpg)
josh mcadamsdoubleclick/performics
![Page 2: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/2.jpg)
use strict;
![Page 3: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/3.jpg)
use strict;
$perl = 'frozen';$ref = 'perl';print $$ref, "\n";
$ perl strict_refs.pl frozen
![Page 4: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/4.jpg)
use strict;
use strict "refs";$perl = 'frozen';$ref = 'perl';print $$ref, "\n";
$ perl strict_refs.pl Can't use string ("perl") as a SCALAR ref while "strict refs" in use at strict_refs.pl line 4.
![Page 5: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/5.jpg)
use strict;
use strict "vars";$perl = 'frozen';$ref = 'perl';print $$ref, "\n";
$ perl strict_vars.pl Global symbol "$perl" requires explicit package name at strict_vars.pl line 2.Global symbol "$ref" requires explicit package name at strict_vars.pl line 3.Global symbol "$ref" requires explicit package name at strict_vars.pl line 4.Execution of strict_vars.pl aborted due to compilation errors.
![Page 6: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/6.jpg)
use strict;
use strict "vars";our $perl = 'frozen';my $ref = 'perl';print $$ref, "\n";
$ perl strict_vars.pl frozen
![Page 7: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/7.jpg)
use strict;
use strict "subs";$person = Josh;$directory{mcadams} = [ first => $person ];print $directory{mcadams}->[1], "\n";
$ perl strict_subs.pl Bareword "Josh" not allowed while "strict subs" in use at strict_subs.pl line 2.Execution of strict_subs.pl aborted due to compilation errors.
![Page 8: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/8.jpg)
use strict;
use strict "subs";$person = ‘Josh’;$directory{mcadams} = [ first => $person ];print $directory{mcadams}->[1], "\n";
$ perl strict_subs.pl Josh
![Page 9: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/9.jpg)
use strict;
- Typically ‘use strict;’ is all that you’ll need
- You can ‘no strict “refs”;’ in your code
- Use the strict pragma in all of your Perl code
![Page 10: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/10.jpg)
use warnings;
![Page 11: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/11.jpg)
use warnings;
perl -w script.pl
#/usr/bin/perl -w
![Page 12: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/12.jpg)
use warnings;
use warnings;
no warnings;
![Page 13: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/13.jpg)
use base;
![Page 14: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/14.jpg)
use base;
push @ISA, ‘SomeModule’;
![Page 15: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/15.jpg)
use base;
use base qw(SomeModule);
![Page 16: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/16.jpg)
use constant;
![Page 17: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/17.jpg)
use constant;
use warnings;use strict;use constant DO_NOT_DISTURB => 1;
print "leave me alone\n" if DO_NOT_DISTURB;
> perl constant.pl leave me alone
![Page 18: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/18.jpg)
use Exporter;
![Page 19: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/19.jpg)
use Exporter;
use MyPackage;
MyPackage::my_subroutine();
![Page 20: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/20.jpg)
use Exporter;
package MyPackage;
use warnings;use strict;use Exporter qw(import);
our @EXPORT_OK = qw(my_subroutine);
sub my_subroutine { print "hello\n";}
1;
![Page 21: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/21.jpg)
use Exporter;
use warnings;use strict;use MyPackage qw(my_subroutine);
my_subroutine();
![Page 22: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/22.jpg)
use Data::Dumper;
![Page 23: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/23.jpg)
use Data::Dumper;
use warnings;use strict;use Data::Dumper;
print Dumper \@ARGV;
> perl datadumper.pl hello frozen perl$VAR1 = [ 'hello', 'frozen', 'perl' ];
![Page 24: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/24.jpg)
use Class::Accessor;
![Page 25: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/25.jpg)
use Class::Accessor;
sub name { my ($self, $value) = @_; $self->{name} = $value if $value; return $self->{name};}
![Page 26: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/26.jpg)
use Class::Accessor;
package MyClass;use base qw(Class::Accessor);__PACKAGE__->mk_accessors(qw(name));
![Page 27: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/27.jpg)
use Carp;
![Page 28: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/28.jpg)
use Carp;
1 package PackageOne; 2 3 sub y { z(); } 4 sub z { die('oops'); } 5 6 package PackageTwo; 7 8 sub a { b(); } 9 sub b { PackageOne::y(); }10 11 package main;12 13 PackageTwo::a();
$ perl die.pl oops at die.pl line 4.
![Page 29: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/29.jpg)
use Carp;
1 package PackageOne; 2 3 use Carp; 4 5 sub y { z(); } 6 sub z { croak('oops'); } 7 8 package PackageTwo; 9 10 sub a { b(); }11 sub b { PackageOne::y(); }12 13 package main;14 15 PackageTwo::a();
$ perl croak.pl oops at croak.pl line 11
![Page 30: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/30.jpg)
use Carp;
1 package PackageOne; 2 3 use Carp qw(confess); 4 5 sub y { z(); } 6 sub z { confess('oops'); } 7 8 package PackageTwo; 9 10 sub a { b(); }11 sub b { PackageOne::y(); }12 13 package main;14 15 PackageTwo::a();
$ perl confess.pl oops at confess.pl line 6 PackageOne::z() called at confess.pl line 5 PackageOne::y() called at confess.pl line 11 PackageTwo::b() called at confess.pl line 10 PackageTwo::a() called at confess.pl line 15
![Page 31: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/31.jpg)
use Carp;
standardcaller’s
perspectivefull stacktrace
warn carp cluck
die croak confess
![Page 32: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/32.jpg)
use Carp::Assert;
![Page 33: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/33.jpg)
use Carp::Assert;
use Carp::Assert;
assert( 1 > 0 );
affirm { my $name = 'Josh'; my @attendees = qw( Josh Heather Addy ); grep { $_ eq $name } @attendees;}
> perl assert.pl
![Page 34: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/34.jpg)
use Carp::Assert;
use Carp::Assert;
assert( 1 > 2);
affirm { my $name = 'Josh'; my @attendees = qw( Josh Heather Addy ); grep { $_ eq $name } @attendees;}
> perl assert.pl Assertion failed! at /opt/local/lib/perl5/site_perl/5.8.8/Carp/Assert.pm line 281 Carp::Assert::assert('') called at assert.pl line 5
![Page 35: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/35.jpg)
use Carp::Assert;
use Carp::Assert;
assert( 1 > 0);
affirm { my $name = 'Joshua'; my @attendees = qw( Josh Heather Addy ); grep { $_ eq $name } @attendees;}
> perl assert.pl Assertion ({ use warnings; use strict 'refs'; my $name = 'Joshua'; my(@attendees) = ('Josh', 'Heather', 'Addy'); grep {$_ eq $name;} @attendees;}) failed! at /opt/local/lib/perl5/site_perl/5.8.8/Carp/Assert.pm line 340 Carp::Assert::affirm('CODE(0x1800ee0)') called at assert.pl line 11
![Page 36: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/36.jpg)
use File::Spec;
![Page 37: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/37.jpg)
use File::Spec;
use warnings;use strict;use File::Spec;
my @dirs = File::Spec->splitdir($0);print '[', join('][', @dirs), "]\n";my $dir = File::Spec->join(@dirs);print $dir, "\n";
> perl /Users/joshua/examples/filespec.pl [][Users][joshua][examples][filespec.pl]/Users/joshua/examples/filespec.pl
![Page 38: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/38.jpg)
use File::stat;
![Page 39: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/39.jpg)
use File::stat;
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat($filename);
![Page 40: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/40.jpg)
use File::stat;
> perl filestat.pl 84
use warnings;use strict;use File::stat;
my $s = stat($0);
print $s->size, "\n";
![Page 41: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/41.jpg)
use File::Slurp;
![Page 42: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/42.jpg)
use File::Slurp;
{ local(*INPUT, $/); open (INPUT, $file) || die "can't open $file: $!"; $var = <INPUT>;}
![Page 43: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/43.jpg)
use File::Slurp;
my $text = read_file( $file );my @lines = read_file( $file );
![Page 44: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/44.jpg)
use File::Slurp;
write_file( $filename, @data );
![Page 45: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/45.jpg)
use File::Copy;
![Page 46: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/46.jpg)
use File::Copy;
use warnings;use strict;use File::Copy;
my $command = "cp $0 $0.bkup";`$command`;
![Page 47: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/47.jpg)
use File::Copy;
use warnings;use strict;use File::Copy;
copy $0, $0 . '.bkup' or die $!;
![Page 48: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/48.jpg)
use File::Temp;
![Page 49: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/49.jpg)
use File::Temp;
use warnings;use strict;use File::Temp;
my $fh = File::Temp->new( UNLINK => 1 );
print $fh->filename, "\n";
> perl tempfile.pl /tmp/yZin81tl6z
![Page 50: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/50.jpg)
use File::Temp;
use warnings;use strict;use File::Temp;
my $fh = File::Temp->newdir( CLEANUP => 1 );
print $fh->dirname, "\n";
> perl tempdir.pl /tmp/HggvehyAyw
![Page 51: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/51.jpg)
use File::Find;
![Page 52: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/52.jpg)
use File::Find;
use warnings;use strict;use File::Find;
find( sub { print "$File::Find::name\n" }, '/Users/joshua/' );
> perl filefind.pl/Users/joshua/...
![Page 53: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/53.jpg)
use File::Next;
![Page 54: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/54.jpg)
use File::Next;
use warnings;use strict;use File::Next;
my $files = File::Next::files( '/Users/joshua/' );
while ( defined ( my $file = $files->() ) ) { print "$file\n";}
> perl filenext.pl/Users/joshua/...
![Page 55: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/55.jpg)
use File::Basename;
![Page 56: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/56.jpg)
use File::Basename;
use warnings;use strict;use File::Basename;
my $file = basename $0;my $path = dirname $0;my ($file2, $path2) = fileparse $0;
print join("\n", $file, $path, $file2, $path2), "\n";
> perl /Users/joshua/examples/basename.pl basename.pl/Users/joshua/examplesbasename.pl/Users/joshua/examples/
![Page 57: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/57.jpg)
use File::HomeDir;
![Page 58: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/58.jpg)
use File::HomeDir;
use warnings;use strict;use File::HomeDir;
print File::HomeDir->my_home(), "\n";print File::HomeDir->my_data(), "\n";
> perl filehomedir.pl /Users/joshua/Users/joshua/Library/Application Support
![Page 59: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/59.jpg)
use IO::File;
![Page 60: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/60.jpg)
use IO::File;
use warnings;use strict;
my $fh;open( $fh, '<', $0 ) or die $!;print while(<$fh>);close $fh;
![Page 61: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/61.jpg)
use IO::File;
use warnings;use strict;use IO::File;
my $fh = IO::File->new( $0, 'r' );print while(<$fh>);$fh->close;
![Page 62: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/62.jpg)
use FindBin;
![Page 63: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/63.jpg)
use FindBin;
package MyModule;
use warnings;use strict;
sub hello { print "hello\n";}
1;
![Page 64: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/64.jpg)
use FindBin;
use warnings;use strict;use lib 'mylib';use MyModule;
MyModule::hello();
> perl findbin.pl hello
![Page 65: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/65.jpg)
use FindBin;
> perl ~/bin/findbin.pl Can't locate MyModule.pm in @INC (@INC contains: mylib /opt/local/lib/perl5/5.8.8/darwin-2level /opt/local/lib/perl5/5.8.8 /opt/local/lib/perl5/site_perl/5.8.8/darwin-2level /opt/local/lib/perl5/site_perl/5.8.8 /opt/local/lib/perl5/site_perl /opt/local/lib/perl5/vendor_perl/5.8.8/darwin-2level /opt/local/lib/perl5/vendor_perl/5.8.8 /opt/local/lib/perl5/vendor_perl .) at Utility Modules That You Should Know About/findbin.pl line 4.BEGIN failed--compilation aborted at Utility Modules That You Should Know About/findbin.pl line 4.
![Page 66: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/66.jpg)
use FindBin;
use warnings;use strict;use FindBin;use lib "$FindBin::Bin/../mylib";use MyModule;
MyModule::hello();
![Page 67: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/67.jpg)
use Getopt::Long;
![Page 68: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/68.jpg)
use Getopt::Long;
use Getopt::Long;
GetOptions( 'greeting=s', 'person=s', 'prefix:s' ) or die('error');
print join( q[ ], $opt_greeting, ($opt_prefix || q[]), $opt_person), "\n";
> perl getopt1.pl --greeting=hello --person=josh --prefix= hello josh
![Page 69: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/69.jpg)
use Getopt::Long;
use warnings;use strict;use Getopt::Long;
my ($greeting, $person, $prefix);GetOptions( 'greeting=s' => \$greeting, 'person=s' => \$person, 'prefix:s' => \$prefix,) or die('error');
print join( q[ ], $greeting, ($prefix || q[]), $person), "\n";
![Page 70: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/70.jpg)
use Getopt::Long;
use warnings;use strict;use Getopt::Long;
my %options;GetOptions( \%options, 'greeting=s', 'person=s', 'prefix:s',) or die('error');
print join( q[ ], @options{qw(greeting prefix person)} ),
"\n";
![Page 71: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/71.jpg)
use Pod::Usage;
![Page 72: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/72.jpg)
use Pod::Usage;
use Getopt::Long;use Pod::Usage;
GetOptions('help', 'man') or pod2usage(2);pod2usage(1) if $opt_help;pod2usage(-verbose => 2) if $opt_man;
__END__
![Page 73: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/73.jpg)
use Pod::Usage;=head1 NAME
sample - Using GetOpt::Long and Pod::Usage
=head1 SYNOPSIS
sample [options]
Options: -help brief help message -man full documentation
=head1 OPTIONS
=over 8
=item B<-help>
Print a brief help message and exits.
=item B<-man>
Prints the manual page and exits.
=back
=head1 DESCRIPTION
Sample is exactly that, a sample.
=cut
![Page 74: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/74.jpg)
use Pod::Usage;
> perl pod_usage.pl -hUsage: pod_usage [options]
Options: -help brief help message -man full documentation
Options: -help Print a brief help message and exits.
-man Prints the manual page and exits.
![Page 75: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/75.jpg)
use Pod::Usage;
> perl pod_usage.pl -mPOD_USAGE(1) User Contributed Perl Documentation POD_USAGE(1)
NAME pod_usage - Using GetOpt::Long and Pod::Usage
SYNOPSIS pod_usage [options]
Options: -help brief help message -man full documentation
OPTIONS -help Print a brief help message and exits.
-man Prints the manual page and exits.
DESCRIPTION pod_usage just an example.
perl v5.8.8 2008-02-16 POD_USAGE(1)
![Page 76: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/76.jpg)
thank you
![Page 77: Utility Modules That You Should Know About](https://reader033.vdocuments.us/reader033/viewer/2022061203/546cea41b4af9f932c8b516a/html5/thumbnails/77.jpg)
yapc.org/America