1IO::TieCombine(3) User Contributed Perl Documentation IO::TieCombine(3)
2
3
4
6 IO::TieCombine - produce tied (and other) separate but combined
7 variables
8
10 version 1.000
11
13 First, we set up a bunch of access points:
14
15 my $hub = IO::TieCombine->new;
16
17 my $str_ref = $hub->scalar_ref('x');
18 my $fh = $hub->fh('x');
19 my $callback = $hub->callback('x');
20
21 tie my $scalar, $hub, 'x';
22 tie local *STDOUT, $hub, 'x';
23
24 tie local *STDERR, $hub, 'err';
25
26 Then we write to things:
27
28 $$str_ref .= 'And ';
29 print $fh "now ";
30 $callback->('for ');
31 $scalar .= 'something ';
32 print "completely ";
33 warn "different.\n";
34
35 And then:
36
37 $hub->combined_contents; # And now for something completely different.
38 $hub->slot_contents('x'); # And now for something completely
39 $hub->slot_contents('err'); # different.
40
42 new
43 The constructor takes no arguments.
44
45 combined_contents
46 This method returns the contents of all collected data.
47
48 slot_contents
49 my $str = $hub->slot_contents( $slot_name );
50
51 This method returns the contents of all collected data for the named
52 slot.
53
54 fh
55 my $fh = $hub->fh( $slot_name );
56
57 This method returns a reference to a tied filehandle. When printed to,
58 output is collected in the named slot.
59
60 scalar_ref
61 my $str_ref = $hub->scalar_ref( $slot_name );
62
63 This method returns a reference to scalar. When appended to, the new
64 content is collected in the named slot. Attempting to alter the string
65 other than by adding new content to its end will result in an
66 exception.
67
68 callback
69 my $code = $hub->callback( $slot_name );
70
72 Ricardo SIGNES <rjbs@cpan.org>
73
75 This software is copyright (c) 2008 by Ricardo SIGNES.
76
77 This is free software; you can redistribute it and/or modify it under
78 the same terms as perl itself.
79
80
81
82perl v5.12.0 2008-10-17 IO::TieCombine(3)