IO::TieCombine(3)
β¨ NAME β¨
Okay bestie, welcome to the IO::TieCombine(3) manual page β yes, the User Contributed Perl Documentation one. This module is here to produce tied (and other) separate but combined variables. Thatβs literally the whole name vibe: IO::TieCombine β produce tied (and other) separate but combined variables. Slay.
π VERSION π
This oneβs at version 1.005. Periodt.
π¦ SYNOPSIS π¦
First, we set up a bunch of access points:
my $hub = IO::TieCombine->new;
my $str_ref = $hub->scalar_ref('x');
my $fh = $hub->fh('x');
my $callback = $hub->callback('x');
tie my $scalar, $hub, 'x';
tie local *STDOUT, $hub, 'x';
tie local *STDERR, $hub, 'err';
Then we write to things:
$$str_ref .= 'And ';
print $fh "now ";
$callback->('for ');
$scalar .= 'something ';
print "completely ";
warn "different.\n";
And then:
$hub->combined_contents; # And now for something completely different.
$hub->slot_contents('x'); # And now for something completely
$hub->slot_contents('err'); # different.
β οΈ ACHTUNG!! Because of a serious problem with Perl 5.10.0, output sent to a tied filehandle usingsaywill not have the expected newline.5.10.1or later is needed. Since5.10.0is broken in so many other ways, you should really upgrade anyway.
β οΈ ACHTUNG!! Because of a different problem with Perls 5.10.1 - 5.16.3, if you send output to a tied filehandle usingsay, and$\is undefined (which is the default),$\will not be restored toundefafter thesay! This means that once youβve usedsayto print to any tied filehandle, you have corrupted the global state of your program. Either start your program by setting$\to an empty string, which should be safe, or upgrade to5.18.0.
π METHODS π
π± new π±
The constructor takes no arguments. Thatβs it, bestie β no extra lilβ parameters to worry about.
πΈ combined_contents πΈ
This method returns the contents of all collected data. Everything from every slot, all combined and ready to read.
π¦ slot_contents π¦
my $str = $hub->slot_contents( $slot_name );
This method returns the contents of all collected data for the named slot. Just the one slot you asked for, no extras.
π§ clear_slot π§
$hub->clear_slot( $slot_name );
This sets the slot back to an empty string. Fresh start energy.
π fh π
my $fh = $hub->fh( $slot_name );
This method returns a reference to a tied filehandle. When printed to, output is collected in the named slot.
π scalar_ref π
my $str_ref = $hub->scalar_ref( $slot_name );
This method returns a reference to scalar. When appended to, the new content is collected in the named slot. Attempting to alter the string other than by adding new content to its end will result in an exception. So yeah β append only, no weird edits.
π callback π
my $code = $hub->callback( $slot_name );
The original page gives you the signature and basically nothing else, so here it is: just the signature, no extra prose.
π AUTHOR π
This absolute icon is Ricardo SIGNES <rjbs@cpan.org>. We stan.
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2015 by Ricardo SIGNES.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
π«Ά Thatβs the wholeIO::TieCombine(3)page, bestie β fromperl v5.42.0, dated2025-06-03. Now go slay β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-IO-TieCombine 1.5.0-bp160.1.2 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms