Rechercher une page de manuel
IO::TieCombine.3pm
Langue: en
Version: 2008-10-17 (debian - 07/07/09)
Section: 3 (Bibliothèques de fonctions)
Sommaire
NAME
IO::TieCombine - produce tied (and other) separate but combined variablesVERSION
version 1.000SYNOPSIS
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.
METHODS
new
The constructor takes no arguments.combined_contents
This method returns the contents of all collected data.slot_contents
my $str = $hub->slot_contents( $slot_name );
This method returns the contents of all collected data for the named slot.
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.
callback
my $code = $hub->callback( $slot_name );
AUTHOR
Ricardo SIGNES <rjbs@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2008 by Ricardo SIGNES.This is free software; you can redistribute it and/or modify it under the same terms as perl itself.
Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre