Note, it also "doesn't work" to interpolate an object method call within a string like you're doing. In other words, "epoch $s->mtime()" (notice the function call interpolated within quotes) doesn't interpolate as a funciton call, it interpolates as "epoch File::stat=ARRAY(0x28fbe6c)->mtime()". In other words, $s is interpolated, but not dereferenced as a method call. It does work to say ParseDateString( "epoch " . $s->mtime() );

This means that on second thought, you don't have a Date::Manip bug there, but rather, a bug in your own script, relying on a function of string interpolation that isn't there. See the following example:

use strict; use warnings; use File::stat; use Date::Manip; my $st = stat( 'router.pl' ) or die "Bleah: $!\n"; my $secs = $st->mtime(); print "Your method of interpolation: $s->mtime()\n"; # See? Wrong. print "Stat info = ", scalar localtime( $secs ), "\n"; # This is just a reality check. print "Using the 'epoch' method: ", ParseDateString( "epoch $secs" ), "\n"; # This works correctly now. print "DateCalc method = ", DateCalc( "Jan 1, 1970 00:00:00 GMT", $secs ), "\n"; # And this works correctly too.

Hope this helps. :)


Dave


In reply to Re^5: Human Readable Date by davido
in thread Human Readable Date by FireyIce01

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.