Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
If you run the following
use Time::Piece; $time = Time::Piece->strptime('2005-02-24 23:000', "%Y-%m-%d %H:%S");
You get:
garbage at end of string in strptime: 0 at C:/Perl/site/lib/Time/Piece +.pm line 442.
The message is correct, but I don't want it to appear - I'd rather capture it in a variable. I've tried wrapping the code in an eval block, but this doesn't help. Any ideas? I suspect that I should be redirecting either STDOUT or STDERR, but I'm not quite clear how to do this as the examples I've seen redirect to a file, whereas I want to do it to a variable.
20050228 Edit by castaway: Changed title from 'Capturing output of Time::Local'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Capturing warnings from Time::Piece
by Tanktalus (Canon) on Feb 24, 2005 at 02:03 UTC | |
by betterworld (Curate) on Feb 24, 2005 at 02:43 UTC | |
|
Re: Capturing warnings from Time::Piece
by sgifford (Prior) on Feb 24, 2005 at 04:11 UTC | |
|
Re: Capturing warnings from Time::Piece
by ikegami (Patriarch) on Feb 24, 2005 at 05:32 UTC | |
|
Re: Capturing warnings from Time::Piece
by Anonymous Monk on Feb 24, 2005 at 03:45 UTC | |
|
Re: Capturing warnings from Time::Piece
by Anonymous Monk on Jun 05, 2017 at 13:19 UTC | |
by LanX (Saint) on Jun 05, 2017 at 13:55 UTC |