Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Date::Manip::Recur is not returning a list

by desertrat (Acolyte)
on Jun 24, 2010 at 21:19 UTC ( #846396=note: print w/ replies, xml ) Need Help??


in reply to Re: Date::Manip::Recur is not returning a list
in thread Date::Manip::Recur is not returning a list

Yes, $recur->parse() only parses the recurrence string, it's $recur->dates() that returns the list of dates. What I don't understand is why it isn't in my case. Clearly it worked for you.

When I try to replicate your code example, I get something new! I'm getting a list, but instead of a list of strings it's a list of hashes...

#!/usr/bin/perl use strict; use warnings; use Date::Manip; print "Content-type: text/html \n\n"; print "Starting....<p>"; my $freq = "0:1:0*25:0:0:0"; my $mod = "DWD"; my $sday = "Jan 1 2010"; my $eday = "Dec 30 2010"; my $bday = "Jan 1 2010"; my $recur = new Date::Manip::Recur; my $err =$recur->parse($freq,$bday,$sday,$eday); print "parse err is $err <p>"; my @date = $recur->dates(); my $datenum = @date; print "There are $datenum list members <p>"; foreach my $i (@date){ print "The date is $i->value<p>"; } exit;
Starting.... parse err is 0 There are 12 list members The date is Date::Manip::Date=HASH(0x8404c00)->value The date is Date::Manip::Date=HASH(0x83ff830)->value ...
headdesk


Comment on Re^2: Date::Manip::Recur is not returning a list
Select or Download Code
Re^3: Date::Manip::Recur is not returning a list
by almut (Canon) on Jun 24, 2010 at 21:28 UTC
    print "The date is $i->value<p>";

    Method calls don't interpolate.  You're interpolating just the value of $i (which is an object/hashref), and the "->value" prints as is. Try

    print "The date is ", $i->value, "<p>";

      Ah, thank you sensei!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://846396]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (18)
As of 2014-07-29 16:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (223 votes), past polls