IO::Pa...uffered(3pm)

πŸ“¦
version 2.10 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– IO::Pager::Unbuffered β€” bestie edition πŸ’–

okay so. this is IO::Pager::Unbuffered, one of the IO::Pager family, from the User Contributed Perl Documentation crew. short version: it pipes your output to whatever's in PAGER when β€” and only when β€” your destination is a TTY. no cap. 🫢


✨ NAME ✨

IO::Pager::Unbuffered β€” literally just: pipe output to PAGER if the destination is a TTY. that's the whole vibe. πŸ’…


🌸 SYNOPSIS 🌸

  use IO::Pager::Unbuffered;
  {
    local $STDOUT = IO::Pager::Unbuffered::open *STDOUT;
    print <<"  HEREDOC" ;
    ...
    A bunch of text later
    HEREDOC
  }

  {
    # You can also use scalar filehandles...
    my $token = IO::Pager::Unbuffered::open($FH) or warn($!);
    print $FH "No globs or barewords for us thanks!\n" while 1;
  }

  {
    # ...or an object interface
    my $token = new IO::Pager::Unbuffered;

    $token->print("OO shiny...\n") while 1;
  }

three whole ways to live your life, bestie. glob, scalar filehandle, or full-on object moment. main character energy, honestly. ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea. the IO::Pager subclasses exist to programmatically decide whether or not to pipe a filehandle's output to a program specified in PAGER. and that PAGER value? it gets determined and set by IO::Pager at runtime, if it's not defined already. iykyk. πŸŽ€

for the actual method deets, go read IO::Pager. this page is not the one carrying that weight. πŸ’€


πŸ‘‘ METHODS πŸ‘‘

every single method here is inherited from IO::Pager β€” except for instantiation. that's it, that's the section. one little exception, iconic behaviour. 🌈


πŸ’€ CAVEATS πŸ’€

bestie. listen. you probably want to do something with SIGPIPE. like. actually. for real. do not skip this one. πŸ™ˆ

eg;

  eval {
    local $SIG{PIPE} = sub { die };
    local $STDOUT = IO::Pager::open(*STDOUT);

    while (1) {
      # Do something
    }
  }

  # Do something else

see how it's wrapped in the eval? that's the point. die gracefully, then go do something else. self-care. 🧚


πŸ”₯ SEE ALSO πŸ”₯

  • IO::Pager
  • IO::Pager::Buffered
  • IO::Pager::Page

(the whole friend group. go say hi. πŸ’œ)


🌟 AUTHOR 🌟

  • Jerrad Pierce <jpierce@cpan.org>
  • Florent Angly <florent.angly@gmail.com>

this module was inspired by Monte Mitzelfelt's IO::Page 0.02 πŸŽ€

and significant proddage was provided by Tye McQueen. (proddage. we love a support system.) 🫢


Copyright (C) 2003-2018 Jerrad Pierce

  • 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.

or, if you prefer:

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.0 or, at your option, any later version of Perl 5 you may have available.


and that's the page!! πŸ’– this little slice of documentation came to you via perl v5.30.3, dated 2020-11-07, under the User Contributed Perl Documentation umbrella. slay, go forth, and page your output responsibly. periodt. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from