Subject: | Passing localtime as a parameter silently fails |
The code below prints "later1later1later2", instead of
"later1later1later2later2" (version 1.2, perl 5.10.1)
use Time::Piece;
my $lt = localtime;
print "later1" if $lt > maketp(); #works
print "later1" if localtime > maketp(); #works
greaterthan($lt); #works
greaterthan(localtime); # does not work
sub greaterthan {
my $lt = shift;
print "later2" if $lt > maketp();
}
sub maketp {
Time::Piece->strptime("10 2 2011","%d %m %Y")
}