perlyogi has asked for the wisdom of the Perl Monks concerning the following question:
Hi Perl Experts, Need your wisdom in solving my following problem. I have used File::Tee module in order to log the contents going to STDOUT in my program. However, i would also like the functionality of unix "less" command in my program to read some pages of content. But, since STDOUT is now tied to the log file, the system command is not producing the output in the format of unix "less" command but producing it as that of unix "cat" command. How should i reset STDOUT, so that the system command produces output in the required format.
use File::Tee; my $logfile = "log.txt"; File::Tee::tee STDOUT, { mode => '>>', lock => 1, open => $logfile }; # I tried to untie STDOUT but it did not work #untie STDOUT &pager(); sub pager { my $temp = "temp.txt"; my $pager = "less"; system("$pager $temp"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Some system command not working as required after File::Tee
by tofanikanudo (Initiate) on Dec 13, 2010 at 12:30 UTC | |
by perlbaba (Initiate) on Dec 13, 2010 at 12:57 UTC | |
by Anonyrnous Monk (Hermit) on Dec 13, 2010 at 13:11 UTC | |
by Khariton (Sexton) on Dec 13, 2010 at 21:01 UTC | |
|
Re: Some system command not working as required after File::Tee
by salva (Canon) on Dec 13, 2010 at 13:16 UTC | |
by perlyogi (Acolyte) on Dec 14, 2010 at 10:28 UTC | |
|
Re: Some system command not working as required after File::Tee
by andal (Hermit) on Dec 13, 2010 at 15:50 UTC |