http://qs1969.pair.com?node_id=1210845

raiserle has asked for the wisdom of the Perl Monks concerning the following question:

Hi, i've copy this code from Perlmonks. file=perlmonks.pl
#! /usr/bin/perl #use strict; #use warnings; use Getopt::Long; use Pod::Usage; &GetOptions( 'h|help' => \$opt_help, 'man' => sub{ pod2usage({-verbose=>2, -exitval=>0}); }, 'q|quiet' => \$opt_quiet, 'c|config=s' => \@opt_config, 'p|project=s' => \$opt_proj ) || pod2usage(1); if($opt_help){ print "help---------------\n"; pod2usage(1); } __END__ =head1 NAME perlmonks.pl - Test for http://perlmonks.org/?node_id=664898 =head1 SYNOPSIS perlmonks.pl [options] Options: -h, --help brief help message --man full documentation =cut
By
./perlmonks.pl -h
this is displayed:
help--------------- Usage: perlmonks.pl [options] Options: -h, --help brief help message --man full documentation
But, the verbose 2 is not working,
./perlmonks.pl -m
this is displayed:
#! /usr/bin/perl #use strict; #use warnings; use Getopt::Long; use Pod::Usage; &GetOptions( 'h|help' => \$opt_help, 'man' => sub{ pod2usage({-verbose=>2, -exitval=>0}); }, 'q|quiet' => \$opt_quiet, 'c|config=s' => \@opt_config, 'p|project=s' => \$opt_proj ) || pod2usage(1); if($opt_help){ print "help---------------\n"; pod2usage(1); } __END__ =head1 NAME perlmonks.pl - Test for http://perlmonks.org/?node_id=664898 =head1 SYNOPSIS perlmonks.pl [options] Options: -h, --help brief help message --man full documentation =cut ./perlmonks.pl (END)
The complete source is shown. What do I have to do to correct the error? regards Henrik

Replies are listed 'Best First'.
Re: Pod does not render correct by verbose 2
by toolic (Bishop) on Mar 13, 2018 at 21:27 UTC
    I am not able to reproduce that behavior on my computer. Are you using a recent version of Perl (perl -v)? I tried it on 5.16 and 5.22.

    What do you get when you try this?

    perldoc perlmonks.pl

    It should behave like verbose 2 (it should use a pager).

    • Read perldoc. Do you have the PERLDOC environment variable set?
    • You might get more debugging info if you: setenv PERLDOCDEBUG 1
      nothing.
      PERLDOCDEBUG=1; export PERLDOCDEBUG; perldoc -F ./perlmonks.pl 'opt_o_with: Noting "text" as desired output format... 'opt_o_with: Considering Pod::Perldoc::Totext 'opt_o_with: Considering Pod::Perldoc::Totext 'opt_o_with: Considering Pod::Perldoc::ToText 'opt_o_with: Considering Pod::Perldoc::ToTEXT 'opt_o_with: Considering Pod::Simple::text 'opt_o_with: Considering Pod::Simple::text 'opt_o_with: Considering Pod::Simple::Text 'opt_o_with: Considering Pod::Simple::TEXT 'opt_o_with: Considering Pod::text 'opt_o_with: Considering Pod::text 'opt_o_with: Considering Pod::Text 'opt_o_with: Considering Pod::TEXT 'opt_o_with: Noting "term" as desired output format... 'opt_o_with: Considering Pod::Perldoc::Toterm 'opt_o_with: Considering Pod::Perldoc::Toterm 'opt_o_with: Considering Pod::Perldoc::ToTerm 'opt_o_with: Considering Pod::Perldoc::ToTERM 'opt_o_with: Considering Pod::Simple::term 'opt_o_with: Considering Pod::Simple::term 'opt_o_with: Considering Pod::Simple::Term 'opt_o_with: Considering Pod::Simple::TERM 'opt_o_with: Considering Pod::term 'opt_o_with: Considering Pod::term 'opt_o_with: Considering Pod::Term 'opt_o_with: Considering Pod::TERM 'GetOptsOO::getopts: Starting switch processing. Scanning arguments [ +-F ./perlmonks.pl] 'GetOptsOO::getopts: Ending switch processing. Args are [./perlmonks. +pl] with 0 errors. 'pagers_guessing: Pagers: /usr/bin/sensible-pagermorelesspgviewcat'pro +cess: /usr/bin/perldoc => Pod::Perldoc v3.2503 Attempting to drop privs... OK, I dropped privileges. 'process: 'find_good_formatter_class: Formatter class Pod::Perldoc::ToTerm versi +on 3.25 successfully loaded! 'find_good_formatter_class: Will format with the class Pod::Perldoc::T +oTerm 'grand_search_init: Searching for ./perlmonks.pl

      In my old debian 4 (etch) I've look to ENV, but nothing for PERLDOC is set, and I'm nothing set after install my new system (debian 9.4 stretch).
      I've only install perdoc on debian 9.4 from mirror, not from CPAN.

      The perl versin on stretch:
      perl -v This is perl 5, version 24, subversion 1 (v5.24.1) built for x86_64-li +nux-gnu-thread-multi (with 75 registered patches, see perl -V for more detail) Copyright 1987-2017, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge.
      regrads Henrik
      I tried a few things.
      I noticed that at

      perldoc Pod::Usage
      'opt_o_with: Noting "text" as desired output format... 'opt_o_with: Considering Pod::Perldoc::Totext 'opt_o_with: Considering Pod::Perldoc::Totext 'opt_o_with: Considering Pod::Perldoc::ToText 'opt_o_with: Considering Pod::Perldoc::ToTEXT 'opt_o_with: Considering Pod::Simple::text 'opt_o_with: Considering Pod::Simple::text 'opt_o_with: Considering Pod::Simple::Text 'opt_o_with: Considering Pod::Simple::TEXT 'opt_o_with: Considering Pod::text 'opt_o_with: Considering Pod::text 'opt_o_with: Considering Pod::Text 'opt_o_with: Considering Pod::TEXT 'opt_o_with: Noting "term" as desired output format... 'opt_o_with: Considering Pod::Perldoc::Toterm 'opt_o_with: Considering Pod::Perldoc::Toterm 'opt_o_with: Considering Pod::Perldoc::ToTerm 'opt_o_with: Considering Pod::Perldoc::ToTERM 'opt_o_with: Considering Pod::Simple::term 'opt_o_with: Considering Pod::Simple::term 'opt_o_with: Considering Pod::Simple::Term 'opt_o_with: Considering Pod::Simple::TERM 'opt_o_with: Considering Pod::term 'opt_o_with: Considering Pod::term 'opt_o_with: Considering Pod::Term 'opt_o_with: Considering Pod::TERM 'GetOptsOO::getopts: Starting switch processing. Scanning arguments [ +Pod::Usage] 'GetOptsOO::getopts: Ending switch processing. Args are [Pod::Usage] +with 0 errors. 'pagers_guessing: Pagers: /usr/bin/sensible-pagermorelesspgviewcat'pro +cess: /usr/bin/perldoc => Pod::Perldoc v3.2503 Attempting to drop privs... OK, I dropped privileges. 'process: 'find_good_formatter_class: Formatter class Pod::Perldoc::ToTerm versi +on 3.25 successfully loaded! 'find_good_formatter_class: Will format with the class Pod::Perldoc::T +oTerm 'grand_search_init: Searching for Pod::Usage 'searchfor: Looking for Pod/Usage in /usr/bin /etc/perl /usr/local/lib +/x86_64-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/x +86_64-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/x86_64-linux-gnu +/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/x86 +_64-linux-gnu/perl-base /usr/local/sbin /usr/local/bin /usr/sbin /usr +/bin /sbin /bin 'grand_search_init: Found as /usr/local/share/perl/5.24.1/Pod/Usage.pm About to call new Pod::Text::Termcap (v4.07) with options: [width 208] Finished writing to /tmp/vpThYSR7Rh. 'page: About to try calling /usr/bin/sensible-pager /tmp/vpThYSR7Rh



      in the debugg more lines than when I call

      perldoc -F .perlmonks.pl
      'opt_o_with: Noting "text" as desired output format... 'opt_o_with: Considering Pod::Perldoc::Totext 'opt_o_with: Considering Pod::Perldoc::Totext 'opt_o_with: Considering Pod::Perldoc::ToText 'opt_o_with: Considering Pod::Perldoc::ToTEXT 'opt_o_with: Considering Pod::Simple::text 'opt_o_with: Considering Pod::Simple::text 'opt_o_with: Considering Pod::Simple::Text 'opt_o_with: Considering Pod::Simple::TEXT 'opt_o_with: Considering Pod::text 'opt_o_with: Considering Pod::text 'opt_o_with: Considering Pod::Text 'opt_o_with: Considering Pod::TEXT 'opt_o_with: Noting "term" as desired output format... 'opt_o_with: Considering Pod::Perldoc::Toterm 'opt_o_with: Considering Pod::Perldoc::Toterm 'opt_o_with: Considering Pod::Perldoc::ToTerm 'opt_o_with: Considering Pod::Perldoc::ToTERM 'opt_o_with: Considering Pod::Simple::term 'opt_o_with: Considering Pod::Simple::term 'opt_o_with: Considering Pod::Simple::Term 'opt_o_with: Considering Pod::Simple::TERM 'opt_o_with: Considering Pod::term 'opt_o_with: Considering Pod::term 'opt_o_with: Considering Pod::Term 'opt_o_with: Considering Pod::TERM 'GetOptsOO::getopts: Starting switch processing. Scanning arguments [ +-F ./perlmonks.pl] 'GetOptsOO::getopts: Ending switch processing. Args are [./perlmonks. +pl] with 0 errors. 'pagers_guessing: Pagers: /usr/bin/sensible-pagermorelesspgviewcat'pro +cess: /usr/bin/perldoc => Pod::Perldoc v3.2503 Attempting to drop privs... OK, I dropped privileges. 'process: 'find_good_formatter_class: Formatter class Pod::Perldoc::ToTerm versi +on 3.25 successfully loaded! 'find_good_formatter_class: Will format with the class Pod::Perldoc::T +oTerm 'grand_search_init: Searching for ./perlmonks.pl



      This is only by perdoc Pod::Usage
      About to call new Pod::Text::Termcap (v4.07) with options: [width 208] Finished writing to /tmp/vpThYSR7Rh. 'page: About to try calling /usr/bin/sensible-pager /tmp/vpThYSR7Rh

      regards
      Henrik
Re: Pod does not render correct by verbose 2
by Laurent_R (Canon) on Mar 13, 2018 at 21:25 UTC
    Hi raiserle,

    did you try:

    ./perlmonks.pl --man
    as it appears to be recommended in the help message?

    Update:It seems that I may have misunderstood your question. Sorry for that if such is the case.

      Yes, but this is the same as
      ./perlmonks.pl -m
      provided by GetOps regards Henrik
      Update: no problem ;)