.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "IO::TieCombine 3pm" .TH IO::TieCombine 3pm "2022-10-13" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" IO::TieCombine \- produce tied (and other) separate but combined variables .SH "VERSION" .IX Header "VERSION" version 1.005 .SH "SYNOPSIS" .IX Header "SYNOPSIS" First, we set up a bunch of access points: .PP .Vb 1 \& my $hub = IO::TieCombine\->new; \& \& my $str_ref = $hub\->scalar_ref(\*(Aqx\*(Aq); \& my $fh = $hub\->fh(\*(Aqx\*(Aq); \& my $callback = $hub\->callback(\*(Aqx\*(Aq); \& \& tie my $scalar, $hub, \*(Aqx\*(Aq; \& tie local *STDOUT, $hub, \*(Aqx\*(Aq; \& \& tie local *STDERR, $hub, \*(Aqerr\*(Aq; .Ve .PP Then we write to things: .PP .Vb 6 \& $$str_ref .= \*(AqAnd \*(Aq; \& print $fh "now "; \& $callback\->(\*(Aqfor \*(Aq); \& $scalar .= \*(Aqsomething \*(Aq; \& print "completely "; \& warn "different.\en"; .Ve .PP And then: .PP .Vb 3 \& $hub\->combined_contents; # And now for something completely different. \& $hub\->slot_contents(\*(Aqx\*(Aq); # And now for something completely \& $hub\->slot_contents(\*(Aqerr\*(Aq); # different. .Ve .PP \&\fB\s-1ACHTUNG\s0!!\fR Because of a serious problem with Perl 5.10.0, output sent to a tied filehandle using \f(CW\*(C`say\*(C'\fR \fBwill not have the expected newline\fR. 5.10.1 or later is needed. Since 5.10.0 is broken in so many other ways, you should really upgrade anyway. .PP \&\fB\s-1ACHTUNG\s0!!\fR Because of a different problem with Perls 5.10.1 \- 5.16.3, if you send output to a tied filehandle using \f(CW\*(C`say\*(C'\fR, and \f(CW\*(C`$\e\*(C'\fR is undefined (which is the default), \fB\f(CB\*(C`$\e\*(C'\fB will not be restored to \f(CB\*(C`undef\*(C'\fB after the \f(CB\*(C`say\*(C'\fB\fR! This means that once you've used \f(CW\*(C`say\*(C'\fR to print to \fIany\fR tied filehandle, you have corrupted the global state of your program. Either start your program by setting \f(CW\*(C`$\e\*(C'\fR to an empty string, which should be safe, or upgrade to 5.18.0. .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" The constructor takes no arguments. .SS "combined_contents" .IX Subsection "combined_contents" This method returns the contents of all collected data. .SS "slot_contents" .IX Subsection "slot_contents" .Vb 1 \& my $str = $hub\->slot_contents( $slot_name ); .Ve .PP This method returns the contents of all collected data for the named slot. .SS "clear_slot" .IX Subsection "clear_slot" .Vb 1 \& $hub\->clear_slot( $slot_name ); .Ve .PP This sets the slot back to an empty string. .SS "fh" .IX Subsection "fh" .Vb 1 \& my $fh = $hub\->fh( $slot_name ); .Ve .PP This method returns a reference to a tied filehandle. When printed to, output is collected in the named slot. .SS "scalar_ref" .IX Subsection "scalar_ref" .Vb 1 \& my $str_ref = $hub\->scalar_ref( $slot_name ); .Ve .PP 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. .SS "callback" .IX Subsection "callback" .Vb 1 \& my $code = $hub\->callback( $slot_name ); .Ve .SH "AUTHOR" .IX Header "AUTHOR" Ricardo \s-1SIGNES\s0 .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2015 by Ricardo \s-1SIGNES.\s0 .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.