1IO::Pager::Buffered(3)User Contributed Perl DocumentationIO::Pager::Buffered(3)
2
3
4

NAME

6       IO::Pager::Buffered - Pipe deferred output to PAGER if destination is a
7       TTY
8

SYNOPSIS

10         use IO::Pager::Buffered;
11         {
12           local $token = IO::Pager::Buffered::open *STDOUT;
13           print <<"  HEREDOC" ;
14           ...
15           A bunch of text later
16           HEREDOC
17         }
18
19         {
20           # You can also use scalar filehandles...
21           my $token = IO::Pager::Buffered::open($FH) or warn($!);
22           print $FH "No globs or barewords for us thanks!\n";
23         }
24
25         {
26           # ...or an object interface
27           my $token = new IO::Pager::Buffered;
28
29           $token->print("OO shiny...\n");
30         }
31

DESCRIPTION

33       IO::Pager subclasses are designed to programmatically decide whether or
34       not to pipe a filehandle's output to a program specified in PAGER;
35       determined and set by IO::Pager at runtime if not yet defined.
36
37       This subclass buffers all output for display upon exiting the current
38       scope.  If this is not what you want look at another subclass such as
39       IO::Pager::Unbuffered. While probably not common, this may be useful in
40       some cases,such as buffering all output to STDOUT while the process
41       occurs, showing only warnings on STDERR, then displaying the output to
42       STDOUT after.  Or alternately letting output to STDOUT slide by and
43       defer warnings for later perusal.
44

METHODS

46       Class-specific method specifics below, others are inherited from
47       IO::Pager.
48
49   open( [FILEHANDLE] )
50       Instantiate a new IO::Pager to paginate FILEHANDLE if necessary.
51       Assign the return value to a scoped variable. Output does not occur
52       until all references to this variable are destroyed eg; upon leaving
53       the current scope. See "DESCRIPTION".
54
55   new( [FILEHANDLE] )
56       Almost identical to open, except that you will get an IO::Handle back
57       if there's no TTY to allow for IO::Pager agnostic programming.
58
59   tell( FILEHANDLE )
60       Returns the size of the buffer in bytes.
61
62   flush( FILEHANDLE )
63       Immediately flushes the contents of the buffer.
64
65       If the last print did not end with a newline, the text from the
66       preceding newline to the end of the buffer will be flushed but is
67       unlikely to display until a newline is printed and flushed.
68

CAVEATS

70       If you mix buffered and unbuffered operations the output order is
71       unspecified, and will probably differ for a TTY vs. a file. See
72       perlfunc.
73
74       $, is used see perlvar.
75

SEE ALSO

77       IO::Pager, IO::Pager::Unbuffered, IO::Pager::Page,
78

AUTHOR

80       Jerrad Pierce <jpierce@cpan.org>
81
82       Florent Angly <florent.angly@gmail.com>
83
84       This module was inspired by Monte Mitzelfelt's IO::Page 0.02
85
87       Copyright (C) 2003-2012 Jerrad Pierce
88
89       ·   Thou shalt not claim ownership of unmodified materials.
90
91       ·   Thou shalt not claim whole ownership of modified materials.
92
93       ·   Thou shalt grant the indemnity of the provider of materials.
94
95       ·   Thou shalt use and dispense freely without other restrictions.
96
97       Or, if you prefer:
98
99       This library is free software; you can redistribute it and/or modify it
100       under the same terms as Perl itself, either Perl version 5.0 or, at
101       your option, any later version of Perl 5 you may have available.
102
103
104
105perl v5.28.0                      2015-02-25            IO::Pager::Buffered(3)
Impressum