neo1491 has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to print the POD as a "usage statement" if the correct parameters aren't passed to the subroutine, but I only want to print the POD which relates to the specific subroutine (I only want to print HelpFOO, not HelpFOO and HelpBAR). Any ideas? Thanks!#!C:/Perl/bin/perl.exe -w use strict; use warnings; use Pod::Text; #------------------------------ =pod =head2 HelpFOO ($status) = FOO($input); Input $input = the first parameter Output status (Success) - 0 (Failure) - non zero Description Description of what FOO does Usage: FOO(input) =cut #------------------------------ sub FOO { my $input = shift; if (!defined($input)){ my $parser = Pod::Text-> new(sentance=>,width=>78); $parser->parse_from_file($0, "-"); } } #------------------------------ =pod =head2 HelpBAR ($status) = BAR($input); Input $input = the first parameter Output status (Success) - 0 (Failure) - non zero Description Description of what BAR does Usage: BAR(input) =cut #------------------------------ sub BAR { my $input = shift; if (!defined($input)){ my $parser = Pod::Text-> new(sentance=>,width=>78); $parser->parse_from_file($0, "-"); } } #execute FOO();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing Pod::Text
by leocharre (Priest) on Jul 16, 2009 at 18:22 UTC | |
|
Re: Parsing Pod::Text
by neo1491 (Beadle) on Jul 16, 2009 at 18:57 UTC | |
by leocharre (Priest) on Jul 17, 2009 at 14:12 UTC |