NAME
IO::Pager - Pipe output to a pager if the output is to a TTY
SYNOPSIS
use IO::Pager;
{
#local $STDOUT = IO::Pager::open *STDOUT;
local $STDOUT = new IO::Pager *STDOUT;
print <<" HEREDOC" ;
...
A bunch of text later
HEREDOC
}
DESCRIPTION
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.
This class is a factory for creating objects defined elsewhere such as IO::Pager::Buffered and IO::Pager::Unbuffered.
Subclasses are only required to support filehandle output methods and close, namely
- CLOSE
-
Supports close() of the filehandle.
-
Supports print() to the filehandle.
- PRINTF
-
Supports printf() to the filehandle.
- WRITE
-
Supports syswrite() to the filehandle.
For anything else, YMMV.
new( [FILEHANDLE], [EXPR] )
Instantiate a new IO::Pager to paginate FILEHANDLE if necessary. Assign the return value to a scoped variable.
See the appropriate subclass for implementation specific details.
- FILEHANDLE
-
Defaults to currently select()-ed FILEHANDLE.
- EXPR
-
An expression which evaluates to the subclass of object to create.
Defaults to IO::Pager::Unbuffered.
open( [FILEHANDLE], [EXPR] )
An alias for new.
close( FILEHANDLE )
Explicitly close the filehandle, this stops any redirection of output on FILEHANDLE that may have been warranted. Normally you'd just wait for the object to pass out of scope.
This does not default to the current filehandle.
See the appropriate subclass for implementation specific details.
ENVIRONMENT
- PAGER
-
The location of the default pager.
- PATH
-
If $ENV{PAGER} is not an absolute path perl will search PATH for the binary.
As a last resort IO::Pager will use File::Which (if available) to search for less and more.
FILES
IO::Pager will fall back to these binaries, in order if $ENV{PAGER} is not executable.
Some method of using a callback as the pager seeks new data. Not sure why that'd be useful but it sounds cool. IO::Pager::Callback?
SEE ALSO
IO::Pager::Buffered, IO::Pager::Unbuffered, IO::Page, Tool::Less
AUTHOR
Jerrad Pierce <jpierce@cpan.org>
This module is forked from IO::Page 0.02 by Monte Mitzelfelt
LICENSE
Thou shalt not claim ownership of unmodified materials.
Thou shalt not claim whole ownership of modified materials.
Thou shalt grant the indemnity of the provider of materials.
Thou shalt use and dispense freely without other restrictions.