Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Pod Usage

by perl@newbie (Novice)
on Sep 09, 2005 at 09:13 UTC ( #490479=perlquestion: print w/ replies, xml ) Need Help??
perl@newbie has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, I am using Pod::usage with Getopt::Long in perl script. For some errors i want to show only my error message and dont want pod to show SYNOPSIS or something else. Is it a way to tell pod2usage module to show only message and nothing else on STDOUT.
Eg. pod2usage( -message => "Syntax Error: Target should be x or y or z")  if($target !~ /..../); Giving this prints the message alongwith the SYNOPSIS Section Eg
"Syntax Error: Target should be x or y or z"
Usage
blah blah blah

Comment on Pod Usage
Download Code
Re: Pod Usage
by Random_Walk (Parson) on Sep 09, 2005 at 10:17 UTC

    Is this what you are looking for ?

    if ($target !~ /..../) { print "Syntax Error: Target should be x or y or z\n"; pod2usage(-verbose => 1); # just the usage exit; }

    Update

    BTW, as I see you are a perl@newbie are you using strict and warnings in your script? If not have a look at Use strict warnings and diagnostics or die to see why it is a good idea.

    Cheers,
    R.

    Pereant, qui ante nos nostra dixerunt!
Re: Pod Usage
by VSarkiss (Monsignor) on Sep 09, 2005 at 16:29 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://490479]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2015-07-04 02:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls