[Chicago-talk] Calculating Holidays

richard at rushlogistics.com richard at rushlogistics.com
Fri Jul 13 06:25:56 PDT 2012


Thanks very much for all the replys. Jay I think you are correct. What I was looking to do is to write a script that alerts me of upcoming holidays. From what I coming to understand the existing perl modules allow me to "do things" with dates. But as I gather I have to supply the dates. What I though might exist was a perl module that actually calculates holidays such that you ask it what day is thanksgiving and it returns the date. It looks like Joel's website does this but I was hoping to avoid depending on an outside source. Also Alan you code is great but I want something that actually crunches the numbers and calculates the dates.

I was on my way to doing this when I started to wonder if someone had already done it and put it in a perl module. I think I will resume the task of writing something on from scratch. 

Thanks again for all of the insightful and supportive replys.

Richard


El Jul 12, 2012, a las 7:53 PM, Jay Strauss <me at heyjay.com> escribió:

> Richard, I get the feeling you are looking for a module with built in
> knowledge of the dates of various holidays.  I'm not sure if such a
> thing exists. (admittedly I haven't searched)
> 
> The docs for DateTime::Event::Holiday::US; seem like it just a module
> for naming dates and proving a wrapper to the underlying  modules
> 
> I think you need a module that let's you supply a calendar (dates with
> names) and then gives you functions for navigating that calendar
> 
> 
> Thanks
> Jay
> 
> Sent from my iPhone
> 
> On Jul 12, 2012, at 12:34 PM, Richard Reina <richard at rushlogistics.com> wrote:
> 
>> 
>> Hi Mike,
>> 
>> Thank you very much for the suggestion.  With some difficulty I was able to get the module installed. However, I am unclear on how it works.  The example given in the docs:
>> 
>> use DateTime::Event::Holiday::US;
>> 
>> my $thanksgiving = DateTime::Event::Holiday::US::holiday( 'Thanksgiving' );
>> 
>> 
>> gives me a hash reference which when I try to dereference with:
>> 
>> my %hash =  %$thanksgiving;
>> 
>> foreach my $k (keys %hash) {
>>       print "$k: $hash{$k}\n";
>>   }
>> 
>> 
>> gives me:
>> 
>> as_ical: ARRAY(0x1e63190)
>> set: Too complex
>> 
>> I was hoping it might give me the date for Thanksgiving.
>> 
>> If any one can give me an idea as to what I am doing wrong in trying to use this module I would really appreciate it.
>> 
>> Thanks,
>> 
>> Richard
>> 
>> 
>> 
>>> 
>>> Mike Fragassi <mikefrag at gmail.com> wrote:
>> 
>>> Try DateTime::Event::Holiday::US.
>> 
>>> On Jul 3, 2012 3:46 PM, <richard at rushlogistics.com> wrote:
>>> 
>>> I am lost trying to write a simple script that tells
>>> me how many days until the next approaching holiday.
>>> has anyone ever done anything similar or know of anything
>>> helpful. I've looked at Date::Manip but that still
>>> leaves me with the cumbersome task of finding out
>>> which holiday is the next one from a given date.
>>> 
>>> Any help would be appreciated as not solving it will
>>> keep me preoccupied all through the holiday.
>>> 
>>> Thanks
>>> 
>>> Richard
>>> _______________________________________________
>>> Chicago-talk mailing list
>>> Chicago-talk at pm.org
>>> http://mail.pm.org/mailman/listinfo/chicago-talk
>> 
>> 
>> --
>> Richard Reina
>> Rush Logistics, Inc.
>> Watch our 3 minute movie:
>> http://www.rushlogistics.com/movie
>> 
>> _______________________________________________
>> Chicago-talk mailing list
>> Chicago-talk at pm.org
>> http://mail.pm.org/mailman/listinfo/chicago-talk
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk


More information about the Chicago-talk mailing list