I'm having an odd Date::Calc problem; I can
use Date::Calc qw(:all);
but apparantly it doesn't export all.. I was writing a test script to prove out the underpinnings of a calendar program (I know there are other 13098130 modules; this is the one I want..); Can anyone explain this?
#!/usr/bin/perl # use strict; use Date::Calc qw(:all); # Need current date my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(t +ime); $year += 1900; $mon ++; my @days = ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'); # How many days in this month? my $ditm = Days_In_Month($year, $mon); # What day of week is first, last day (so we can fill calendar out) my $dow_first = Day_of_Week($year, $mon, 1); my $dow_last = Day_of_Week($year, $mon, 30); print "Year = $year\n"; print "Month = $mon\n"; print "Day = $mday\n"; print "ditm = $ditm\n"; print "dow_first= $days[$dow_first]\n"; print "dow_last= $days[$dow_last]\n";
Running this as-is returns:
Undefined subroutine &main::Days_In_Month called at ./test.pl line 16.

If I comment out the two lines regarding $ditm/Days_In_Month, the calls to Day_of_Week work fine:
:!./test.pl Year = 2004 Month = 6 Day = 7 dow_first= Tue dow_last= Wed

What the heck?

In reply to Date::Calc sub issue by keck

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.