Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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 ...

Replies are listed 'Best First'.
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?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2018-12-11 00:27 GMT
Find Nodes?
    Voting Booth?
    How many stories does it take before you've heard them all?

    Results (52 votes). Check out past polls.

    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!