CC: | explorer [...] cpan.org |
Subject: | Pod::Perldoc::ToTerm doesn't respect terminal width settings |
Problems:
1.- Now, Pod::Perldoc use Pod::Perldoc::ToTerm formatter:
Perldoc.pm:
473 $self->opt_o_with('term') unless $self->is_mswin32 || $self->is_dos
and the width of screen is taken from
Text.pm:
121 $$self{opt_width} = 76 unless defined $$self{opt_width};
and more later:
Text/Termcap.pm:
69 unless (defined $$self{width}) {
70 $$self{opt_width} = $ENV{COLUMNS} || $$term{_co} || 80;
71 $$self{opt_width} -= 2;
72 }
a.- What is $$self{width}? It is not used anymore... Maybe 'opt_width'? but... Text.pm initialized $$self{opt_width}, ever
b.- $$self{opt_width} is initialized with $ENV{COLUMNS} or $$term{_co}. My screen (tmux, TERM=screen) have $COLUMNS environment variable but is not exported (I will need to write "export COLUMNS" into .bashrc file), so $ENV{COLUMNS} is void. Then, $$self{opt_width} is set with the $$term{_co} value (80 columns, ever, because is a capability (Term::Cap)).
Result: the pod is formatted to 80-2 columns, ever.
At Perl v5.14, Pod::Perldoc::ToMan used `stty -a` to get width screen.
If I change $$self{width} with $$self{opt_width}, this line work:
$ perldoc -w width:$[COLUMNS-2] perldata
If I leave $$self{width}, this work:
$ export COLUMNS
$ perldoc perldata
Best solution I found:
A.- Comment or remove line 121 of Text.pm (don't initialize $$self{opt_width})
B.- Change $$self{width} with $$self{opt_width} at Text/Termcap.pm
C.- $ export COLUMNS (or in .bashrc)
D.- $ perldoc perldata