Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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]
[james28909]: politicians making jobs for themselves? that is absurd! we all know how hard those politicians have it, having to take millions from lobbiest while screwing over their citizens. have a little sympathy why dont ya!

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2017-12-15 18:33 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (442 votes). Check out past polls.