Hi guys,
how can i dup output both stdout and a log file at a time.
pls consider below sample script,
use Test::More qw(no_plan);
$\="\n";
# here will be file name which will store the log o/p
print "hello world";
pass("hello world");
fail("do nothing");
diag("hi frend");
use_ok("fake_module");
print "bye";
so that it will print,
hello world
ok 1 - hello world
not ok 2 - do nothing
# Failed test 'do nothing'
# at C:/test/tst.pl line 8.
# hi frend
not ok 3 - use fake_module;
# Failed test 'use fake_module;'
# at C:/test/tst.pl line 10.
bye
# Tried to use 'fake_module'.
# Error: Can't locate fake_module.pm in @INC (@INC contains: C:/test C
+:/strawberry/perl/lib C:/strawberry/perl/site/lib .) at (eval 4) line
+ 2.
# BEGIN failed--compilation aborted at (eval 4) line 2.
1..3
# Looks like you failed 2 tests of 3.
into both stdout and log file.I tried IO::Tee, but failed to achieve my goal.I guess i would also need to redirect stderr to log file.
cheers !!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.