Skip Menu |
 

This queue is for tickets about the Pod-Usage CPAN distribution.

Report information
The Basics
Id: 86932
Status: resolved
Worked: 15 min
Priority: 0/
Queue: Pod-Usage

People
Owner: Marek.Rouchal [...] gmx.net
Requestors: michaelgang [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 1.64



Subject: documentation does not work with use strict
Date: Mon, 15 Jul 2013 10:10:20 +0300
To: bug-Pod-Usage [...] rt.cpan.org
From: Michael Gang <michaelgang [...] gmail.com>
Download (untitled) / with headers
text/plain 1.1k
Hi, The example in the module use Pod::Usage <https://metacpan.org/module/Pod::Usage>; use Getopt::Long <https://metacpan.org/module/Getopt::Long>; ## Parse options GetOptions("help", "man", "flag1") || pod2usage(2); pod2usage(1) if ($opt_help); pod2usage(-verbose => 2) if ($opt_man); ## Check for too many filenames pod2usage("$0: Too many files given.\n") if (@ARGV > 1); is based on the fact that use strict is not on. This is generally a bad example as most perl users use strict. There is a much better example in Getopt::Long use <http://perldoc.perl.org/functions/use.html> Getopt::Long; use <http://perldoc.perl.org/functions/use.html> Pod::Usage; my <http://perldoc.perl.org/functions/my.html> $man = 0; my <http://perldoc.perl.org/functions/my.html> $help = 0; GetOptions('help|?' => \$help, man => \$man) or <http://perldoc.perl.org/functions/or.html> pod2usage(2); pod2usage(1) if <http://perldoc.perl.org/functions/if.html> $help; pod2usage(-exitval => 0, -verbose => 2) if <http://perldoc.perl.org/functions/if.html> $man; I would just use this example instead. Thanks, David


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.