Wednesday, May 11, 2011

perl overriding example

#Earlier in the program, you must have requested to override localtime with one that returns an object. You can access the builtin localtime using

my @timeData = CORE::localtime(time);
print join(' ', @timeData);
print "\n\n\n"; 


#You're using Time::localtime somewhere, and that is turning the results of localtime into an object.
#Also note it is redundant to pass time as a parameter to localtime.

use Time::localtime;
print "Object: ", join(' ', localtime), "\n";
print "Array: ", join(' ', CORE::localtime), "\n";
exit;

No comments: