Conal has asked for the wisdom of the Perl Monks concerning the following question:
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; ## 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";
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?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>';}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Date::Day issues
by cdarke (Prior) on Mar 25, 2010 at 06:57 UTC | |
by Conal (Beadle) on Mar 25, 2010 at 07:11 UTC | |
by ikegami (Patriarch) on Mar 25, 2010 at 07:38 UTC | |
by Conal (Beadle) on Mar 25, 2010 at 07:47 UTC | |
by cdarke (Prior) on Mar 25, 2010 at 08:52 UTC | |
| |
by ikegami (Patriarch) on Mar 25, 2010 at 08:25 UTC | |
|
Re: Date::Day issues
by Marshall (Canon) on Mar 25, 2010 at 11:15 UTC |