hkpatv has asked for the wisdom of the Perl Monks concerning the following question:
Note that only "one" gets written to test.out. The documentation for TeeOutput states "The filehandle must be passed as an unquoted typeglob." I am not sure how to achieve that from a regular filehandle. (Note I actually want to store result in string variable but this is the first step) Any help appreciated.#!/usr/bin/perl -w use Local::TeeOutput; use IO::File; use strict; local *LOG; open (LOG, ">>test.out"); openTee(*STDOUT, *STDOUT, *LOG); print "One\n"; closeTee(*STDOUT); my $fh = IO::File->new(">>test.out"); openTee(*STDOUT, *STDOUT, $fh); print "Two\n"; closeTee(*STDOUT);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems with Filehandles and TeeOutput
by ikegami (Patriarch) on Aug 26, 2008 at 02:49 UTC | |
by hkpatv (Initiate) on Aug 26, 2008 at 05:24 UTC | |
by ikegami (Patriarch) on Aug 26, 2008 at 05:56 UTC | |
by hkpatv (Initiate) on Aug 26, 2008 at 09:24 UTC | |
by ikegami (Patriarch) on Aug 26, 2008 at 18:08 UTC | |
by massa (Hermit) on Aug 26, 2008 at 09:41 UTC | |
by ikegami (Patriarch) on Aug 26, 2008 at 17:27 UTC | |
by hkpatv (Initiate) on Aug 27, 2008 at 01:33 UTC | |
|
Re: Problems with Filehandles and TeeOutput
by massa (Hermit) on Aug 26, 2008 at 02:25 UTC | |
|
Re: Problems with Filehandles and TeeOutput
by apl (Monsignor) on Aug 26, 2008 at 10:52 UTC |