[Announce] updated version of DateTime::Event::Sunrise on CVS
Hi All, I have just updated the DateTime::Event::Sunrise package on CVS. I have added a new method sunrise_sunset (and a new method). Basically, it will return a DateTime Span containing the rise/set times. Example: use DateTime; use DateTime::Event::Sunrise; use strict; use warnings; my $dt = DateTime-new( year = 2000, month = 6, day= 20, time_zone = 'America/Los_Angeles', ); my $sunrise = DateTime::Event::Sunrise -new( longitude ='-118' , latitude = '33', ); my $tmp = $sunrise-sunrise_sunset($dt); print Sunrise is: , $tmp-start-datetime , \n; print Sunset is: , $tmp-end-datetime; If I don't hear any complains I will release to CPAN next week as version 0.05. Thanks Ron Hill
Re: [Announce] updated version of DateTime::Event::Sunrise on CVS
Hill, Ronald wrote: Hi All, I have just updated the DateTime::Event::Sunrise package on CVS. I have added a new method sunrise_sunset (and a new method). Basically, it will return a DateTime Span containing the rise/set times. Example: [...] my $sunrise = DateTime::Event::Sunrise -new( longitude ='-118' , latitude = '33', ); my $tmp = $sunrise-sunrise_sunset($dt); print Sunrise is: , $tmp-start-datetime , \n; print Sunset is: , $tmp-end-datetime; If I don't hear any complains I will release to CPAN next week as version 0.05. Is this too verbose? my $dt_span = $sunrise-sunrise_sunset_span( datetime = $dt ); print Sunrise is: , $dt_span-start-datetime , \n; print Sunset is: , $dt_span-end-datetime; my $dt_set = $sunrise-sunrise_set( %optional_parameters ); my $dt_set2 = $sunrise-sunset_set( %optional_parameters ); my $dt = $sunrise-sunrise_dt( datetime = $dt ); my $dt2 = $sunrise-sunset_dt( datetime = $dt ); - Flavio S. Glock
RE: [Announce] updated version of DateTime::Event::Sunrise on CVS
Flavio S. Glock wrote: Hill, Ronald wrote: Hi All, I have just updated the DateTime::Event::Sunrise package on CVS. I have added a new method sunrise_sunset (and a new method). [snipped] Is this too verbose? my $dt_span = $sunrise-sunrise_sunset_span( datetime = $dt ); print Sunrise is: , $dt_span-start-datetime , \n; print Sunset is: , $dt_span-end-datetime; Ok, easy enought to fix. my $dt_set = $sunrise-sunrise_set( %optional_parameters ); my $dt_set2 = $sunrise-sunset_set( %optional_parameters ); I don't understand this? my $dt = $sunrise-sunrise_dt( datetime = $dt ); my $dt2 = $sunrise-sunset_dt( datetime = $dt ); Ok, I will add another method for this. Thanks Flavio Ron Hill
Re: [Announce] updated version of DateTime::Event::Sunrise on CVS
Hill, Ronald wrote: my $dt_set = $sunrise-sunrise_set( %optional_parameters ); my $dt_set2 = $sunrise-sunset_set( %optional_parameters ); I don't understand this? I made a few changes, I hope it makes more sense: my $sun = DateTime::Event::Sunrise-new( longitude ='-118' , latitude = '33' ); my $dt1 = $sun-sunrise_datetime( $dt ); print Sunrise is: , $dt1-datetime , \n; my $dt2 = $sun-sunset_datetime( $dt ); print Sunset is: , $dt2-datetime , \n; my $dt_span = $sun-sunrise_sunset_span( datetime = $dt ); print Sunrise is: , $dt_span-start-datetime , \n; print Sunset is: , $dt_span-end-datetime , \n; my $sunrise_set = $sun-sunrise( %optional_span ); print Sunrise is: , $sunrise_set-previous( $dt ) , \n; my $sunset_set = $sun-sunset ( %optional_span ); print Sunset is: , $sunset_set-next( $dt ) , \n; I mean, you have a single factory object - It can make DT, DT::Set, and DT::Span objects. I'm not sure whether sunrise_set() is a better name than sunrise(), for the method that makes DT::Sets. This is overkill, maybe: (and the name is very strange) my $sunny_spanset = $sun-sunrise_sunset_spanset( %optional_span ); print This is night\n unless $sunny_spanset-contains( $dt ); - Flavio S. Glock