hullo. I have a little perl script that gets the day from a MYSQL DATETIME. It looks like this.
use Date::Day; ## The following will print the weekday corresponding my $fragment = '2010-03-23 17:00:00'; $fragment = substr $fragment, 0, 10; my ( $year, $month, $day ) = split /-/, $fragment; $fragment = &day($month,$day,$year); $fragment = $fragment." $day-$month"; print "$fragment";
It works perfectly as expected. My problem is when i try to reuse it within a set of perl modules to write the day to a HTML file, it fails. the relevant section of code looks like this:
use Date::Day; ... my $fragment; if ($table =~ m/daily/) {$fragment = substr $ref->{'time'}, 0, 10; my ( $year, $month, $day ) = split /-/, $fragment; $fragment = &day($month,$day,$year); $fragment = $fragment." $day-$month"; } + else {$fragment = substr $ref->{'time'}, 11, 5;} + #write times to micro HTML printf MICROHTML '<td class="time">'; printf MICROHTML "$fragment"; printf MICROHTML '</td>';}
the $ref{'time'} is a variable used to store the MYSQL DATETIME and i know this is 100% working as i can dump out date info to HTML no problem, its when trying to use the Day method from Date::Day that i get a problem. The code is 'live' and runs on everyday at 5pm on a scheduled task so its hard for me to thouroghly debug the issue. I have been trying suss out what is wrong for a while now but cant put my finger on it. Can anyone help?
conal.

In reply to Date::Day issues by Conal

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.