quixadhal has asked for the wisdom of the Perl Monks concerning the following question:
After some fiddling, I got it to work reasonably well, with one minor exception. I can't set the width of the output.
My terminal is 191 characters wide. Using perldoc Test.pm, it correctly formats the documentation to that width. Using pod2usage(), it uses the default width of 76 characters.
I can't figure out how to get the width option passed in to the formatter. The documentation shows how to set a different formatter (such as Pod::Text::Termcap) using a BEGIN block, and I used Term::ReadKey to pull the width (verified), but I just can't get the formatter to see it.
Any hints?
package Test; BEGIN { use Term::ReadKey; my ($width, $height, $pixel_width, $pixel_height) = GetTerminalSiz +e(); #print "WIDTH: $width\n"; $Pod::Usage::Formatter = 'Pod::Text::Termcap'; $Pod::Usage::width = $width; } use Pod::Usage; use Pod::Find qw(pod_where); # stuff GetOptionsFromArray( \@args , 'help|?' => sub { pod2usage( -width => $width, -input = +> pod_where( {-inc => 1}, __PACKAGE__), -exitval => 1 ); }, 'man' => sub { pod2usage( -input => pod_where( {-inc + => 1}, __PACKAGE__), -exitval => 2, -verbose => 2 ); }, );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: pod2usage width (OT)
by ww (Archbishop) on Oct 13, 2013 at 11:50 UTC |