|
IO::Pager::Unbuffered - Pipe output to a pager if output is to a TTY |
IO::Pager::Unbuffered - Pipe output to a pager if output is to a TTY
use IO::Pager::Unbuffered;
{
#local $STDOUT = IO::Pager::Unbuffered::open *STDOUT;
local $STDOUT = new IO::Pager::Unbuffered *STDOUT;
print <<" HEREDOC" ;
...
A bunch of text later
HEREDOC
}
IO::Pager is designed to programmaticly decide whether or not to point the STDOUT file handle into a pipe to program specified in $ENV{PAGER} or one of a standard list of pagers.
Instantiate a new IO::Pager to paginate FILEHANDLE if necessary. Assign the return value to a scoped variable.
An alias for new.
Explicitly close the filehandle, if a pager was deemed necessary this will kill it. Normally you'd just wait for the user to exit the pager and the object to pass out of scope.
This does not default to the current filehandle.
You probably want to do something with SIGPIPE eg;
eval{
$SIG{PIPE} = sub{ die };
local $STDOUT = IO::Pager::open(*STDOUT);
while(1){
#Do something
}
}
#Do something else
the IO::Pager manpage, the IO::Pager::Buffered manpage, the IO::Pager::Page manpage
Jerrad Pierce <jpierce@cpan.org>
This module is forked from IO::Page 0.02 by Monte Mitzelfelt
Significant proddage provided by Tye McQueen.
|
IO::Pager::Unbuffered - Pipe output to a pager if output is to a TTY |