Skip Menu |
 

This queue is for tickets about the DateTime-Event-Sunrise CPAN distribution.

Report information
The Basics
Id: 91783
Status: resolved
Priority: 0/
Queue: DateTime-Event-Sunrise

People
Owner: Nobody in particular
Requestors: lars.nooden [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.0504



Subject: DateTime::Event::Sunrise carps to stderr during the polar day or night
Date: Wed, 01 Jan 2014 22:08:16 +0200
To: bug-DateTime-Event-Sunrise [...] rt.cpan.org
From: Lars Noodén <lars.nooden [...] gmail.com>
Download (untitled) / with headers
text/plain 1.2k
DateTime::Event::Sunrise carps to stderr during the polar day or night. I'd like to quiet the error messages that result from using the module during periods when the sun does not set or does not rise. The expected result would be that DateTime::Event::Sunrise should not produce anything on stderr, except when a real error occurs. The sun not rising or setting is quite normal in certain latitudes during some parts of the year and not an error. This important because the further north or south one goes, the more noise (can be log noise in certain uses) this misuse of carp causes. A quick and dirty solution is to comment out the offending lines: 542c542 < carp "Sun never rises!!\n"; --- Show quoted text
> # carp "Sun never rises!!\n";
546c546 < carp "Sun never sets!!\n"; --- Show quoted text
> # carp "Sun never sets!!\n";
A fancier option (which I can't add myself) would be to make carping optional or to have some flag to indicate night or day. This is in version 0.0503: $VERSION = '0.0503'; on perl 5.18.1: perl 5, version 18, subversion 1 (v5.18.1) built for x86_64-linux-gnu-thread-multi on Ubuntu: Linux lubuntu 3.12.0-7-generic #15-Ubuntu SMP Sun Dec 8 23:39:27 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux Regards, /Lars
Download (untitled) / with headers
text/plain 1.6k
Le Mer 01 Jan 2014 21:08:29, lars.nooden@gmail.com a écrit : Show quoted text
> DateTime::Event::Sunrise carps to stderr during the polar day or night. > I'd like to quiet the error messages that result from using the module > during periods when the sun does not set or does not rise. > > The expected result would be that DateTime::Event::Sunrise should not > produce anything on stderr, except when a real error occurs. The sun > not rising or setting is quite normal in certain latitudes during some > parts of the year and not an error. > > This important because the further north or south one goes, the more > noise (can be log noise in certain uses) this misuse of carp causes. > > A quick and dirty solution is to comment out the offending lines: > > 542c542 > < carp "Sun never rises!!\n"; > ---
> > # carp "Sun never rises!!\n";
> 546c546 > < carp "Sun never sets!!\n"; > ---
> > # carp "Sun never sets!!\n";
> > A fancier option (which I can't add myself) would be to make carping > optional or to have some flag to indicate night or day. >
I have told about this problem in the 0.0503 announce message: http://grokbase.com/t/perl/datetime/13ajdqx1sq/announce-datetime-event-sunrise-0-0503-and-possible-evolution-for-0-0504 but I was warnocked. I prefer solution 1, that is, create a "sun_does_rise" method and a "sun_does_set" method. You will have to call these methods and check their return values before calling the usual method. Now, what I need is a few round tuits and code and release version 0.0504. In the meantime, you can apply the quick and dirty method you suggested. And by the way, happy new year Lars (and other rt.cpan.org users). Jean Forget
Subject: Re: [rt.cpan.org #91783] DateTime::Event::Sunrise carps to stderr during the polar day or night
Date: Thu, 02 Jan 2014 00:00:05 +0200
To: bug-DateTime-Event-Sunrise [...] rt.cpan.org
From: Lars Noodén <lars.nooden [...] gmail.com>
On 01/01/2014 11:51 PM, Jean Forget via RT wrote: Show quoted text
> I have told about this problem in the 0.0503 announce message: > http://grokbase.com/t/perl/datetime/13ajdqx1sq/announce-datetime-event-sunrise-0-0503-and-possible-evolution-for-0-0504 > but I was warnocked. I prefer solution 1, that is, create a > "sun_does_rise" method and a "sun_does_set" method. > You will have to call these methods and check their > return values before calling the usual method. > > Now, what I need is a few round tuits and code and release version 0.0504. > In the meantime, you can apply the quick and dirty method you suggested. > > And by the way, happy new year Lars (and other rt.cpan.org users). > > Jean Forget >
Thanks. And happy new year, too. The methods in solution #1 or #2 sound useful. They would solve another task that I normally have to work out in the code of the main program. I Am Not An Astronomer, but maybe the method names could be "polar_night" and "polar_day". That way it would not be so confusing when they return true or false. Regards, /Lars
Download (untitled) / with headers
text/plain 1.6k
Le Mer 01 Jan 2014 23:00:22, lars.nooden@gmail.com a écrit : Show quoted text
>[cut] > > The methods in solution #1 or #2 sound useful. They would solve > another > task that I normally have to work out in the code of the main program. > I Am Not An Astronomer, but maybe the method names could be > "polar_night" and "polar_day". That way it would not be so confusing > when they return true or false. > > Regards, > /Lars
I am not a professional astronomer, I am not even a field amateur astronomer using tools such as a telescope, I am just an armchair amateur astronomer with a few books on my bookshelves and a few bookmarks in my web browser. The "polar_night" and "polar_day" methods have a problem on edge cases. For an arctic (or antarctic) location, there is a date in spring when the day-night cycle ends and the polar day begins. During this second date, the "sun_does_rise" method would return true and the "sun_does_set" method would return false. But what would the "polar_day" method return? On the other hand, even if I code a "sun_does_rise" method and a "sun_does_set" method, that does not prevent me from coding a "polar_day" and a "polar_night" methods as well. By the way, if you have a Github account, you should keep watch on https://github.com/jforget/DateTime-Event-Sunrise Another point: in version 0.0503, I have changed the POD to use Perl-significant examples (YAPC Europe 2013 and YAPC NA 2013 locations and dates) instead of arbitrary locations and dates. Do you know of a arctic or antarctic location which would be significant for the Perl community? It seems that the Antarctica CPAN mirror is no longer active. Jean Forget
Subject: ANNOUNCE DateTime::Event::Sunrise 0.0504 (was: carps to stderr during the polar day or night)
RT-Send-CC: datetime [...] perl.org
Download (untitled) / with headers
text/plain 1.4k
Le Mer 01 Jan 2014 23:00:22, lars.nooden@gmail.com a écrit : Show quoted text
> On 01/01/2014 11:51 PM, Jean Forget via RT wrote:
> > I have told about this problem in the 0.0503 announce message: > > http://grokbase.com/t/perl/datetime/13ajdqx1sq/announce-datetime- > > event-sunrise-0-0503-and-possible-evolution-for-0-0504 > > but I was warnocked. I prefer solution 1, that is, create a > > "sun_does_rise" method and a "sun_does_set" method. > > You will have to call these methods and check their > > return values before calling the usual method. > > > > Now, what I need is a few round tuits and code and release version > > 0.0504. > > In the meantime, you can apply the quick and dirty method you > > suggested. > > > > And by the way, happy new year Lars (and other rt.cpan.org users). > > > > Jean Forget > >
> Thanks. And happy new year, too. > > The methods in solution #1 or #2 sound useful. They would solve > another > task that I normally have to work out in the code of the main program. > I Am Not An Astronomer, but maybe the method names could be > "polar_night" and "polar_day". That way it would not be so confusing > when they return true or false. > > Regards, > /Lars
I finally gathered enough tuits to release the 0.0504 version. This version includes new methods "is_polar_day", "is_polar_night" and "is_day_and_night". You have also a new parameter for the "new" method: "silent", which suppresses the "never sets/rises" warnings.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.