IO::Pipe(3perl)

πŸ’– IO::Pipe β€” supply object methods for pipes πŸ’–

okay bestie, so this is IO::Pipe, a lil module from the Perl Programmers Reference Guide that gives you πŸ’«object methodsπŸ’« for making pipes. It's giving very much "I don't want to wrangle raw filehandles myself" energy, and honestly? Slay.


✨ SYNOPSIS ✨

        use IO::Pipe;

        $pipe = IO::Pipe->new();

        if($pid = fork()) { # Parent
            $pipe->reader();

            while(<$pipe>) {
                ...
            }

        }
        elsif(defined $pid) { # Child
            $pipe->writer();

            print $pipe ...
        }

        or

        $pipe = IO::Pipe->new();

        $pipe->reader(qw(ls -l));

        while(<$pipe>) {
            ...
        }
fr fr this is the whole vibe in one code block β€” fork it, read from one end, write to the other, and let the module handle the ✨drama✨.

🌸 DESCRIPTION 🌸

IO::Pipe provides an interface to creating pipes between processes.

that's it. that's the whole thing. no cap. pipes between processes, made cute. πŸ¦‹


πŸŽ€ CONSTRUCTOR πŸŽ€

  • new ( [READER, WRITER] ) β€” makes you a brand-new IO::Pipe, which is literally a reference to a newly created symbol (peep the Symbol package if you're nosy πŸ‘€). IO::Pipe::new optionally takes two arguments, and those two besties should be objects blessed into IO::Handle, or some subclass of it. Those two objects are what get used for the system call to pipe. And if you hand it no arguments at all? Then the method handles gets called on the fresh new IO::Pipe object instead. πŸ’…

Those two handles live in the array part of the GLOB until either reader or writer gets called. like, they're just chillin there. waiting for their moment. main character energy ⭐


🫢 METHODS 🫢

  • reader ([ARGS]) β€” the object gets re-blessed into a sub-class of IO::Handle and becomes a handle sitting at the reading end of the pipe. πŸ“– And if you pass ARGS? Then fork gets called and ARGS get passed along to exec. iykyk.
  • writer ([ARGS]) β€” same deal, bestie: the object is re-blessed into a sub-class of IO::Handle and becomes a handle at the writing end of the pipe. ✍️ And yep, if ARGS are given, fork is called and ARGS are passed to exec. twin behavior.
  • handles () β€” this one gets called during construction, by IO::Pipe::new, on the freshly created IO::Pipe object. It hands back an array of two objects blessed into IO::Pipe::End, or a subclass of it. two lil ends. a whole pipe. obsessed. πŸŽ€

πŸ‘‘ SEE ALSO πŸ‘‘

IO::Handle


πŸ’œ AUTHOR πŸ’œ

Graham Barr. Currently maintained by the Perl Porters. Please report all bugs at <https://github.com/Perl/perl5/issues>.

(if something's broken, go tell them!! they want to know!! πŸ›)


Copyright (c) 1996-8 Graham Barr <gbarr@pobox.com>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


and that's the whole page, bestie!! πŸ₯³ this was documented for perl v5.44.0, dated 2026-10-17 β€” so yeah, she's fresh, she's iconic, she's IO::Pipe(3perl). go make some pipes. you're gonna eat. πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from
  • arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms