Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DateTime-Format-Pg CPAN distribution.

Report information
The Basics
Id: 27222
Status: resolved
Priority: 0/
Queue: DateTime-Format-Pg

People
Owner: Nobody in particular
Requestors: GHENRY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.15
Fixed in: (no value)



Subject: parse_interval will not parse '-100:33:00'
Download (untitled) / with headers
text/plain 346b
Hi, I can't seem to get parse_interval to parse negative formats, for example: #!/usr/bin/perl use strict; use warnings; use DateTime::Format::Pg; print DateTime::Format::Pg->parse_interval('-100:33:00'); Gives: Invalid interval string at test.pl line 6 -100:33:00 is an interval returned from one of our Pg functions. Thanks, Gavin.
From: DMAKI [...] cpan.org
Download (untitled) / with headers
text/plain 125b
I think this has to do more with that parse_duration couldn't handle hours greater than 99. I've fixed that and uploaded 0.16
Subject: Re: [rt.cpan.org #27222] parse_interval will not parse '-100:33:00'
Date: Tue, 22 May 2007 09:39:10 +0100 (BST)
To: bug-DateTime-Format-Pg [...] rt.cpan.org
From: "Gavin Henry" <ghenry [...] cpan.org>
Download (untitled) / with headers
text/plain 537b
<quote who="via RT"> Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=27222 > > > I think this has to do more with that parse_duration couldn't handle > hours greater than 99. I've fixed that and uploaded 0.16 >
Excellent. You've got to love the CPAN, Perl and Open Source in general to get bug fixes this quick! ;-) Will install and test. BTW, We're using your module quite heavily in http://www.flexitimemanager.co.uk, a new Catalyst, Dojo and Pg application. So we'll fire over any more things we find. Thanks again, Gavin.
Subject: Re: [rt.cpan.org #27222] parse_interval will not parse '-100:33:00'
Date: Tue, 22 May 2007 10:01:06 +0100 (BST)
To: bug-DateTime-Format-Pg [...] rt.cpan.org
From: "Gavin Henry" <ghenry [...] cpan.org>
Download (untitled) / with headers
text/plain 551b
<quote who="via RT"> Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=27222 > > > I think this has to do more with that parse_duration couldn't handle > hours greater than 99. I've fixed that and uploaded 0.16 >
Tested, but it doesn't honour the negative sign, e.g.: #!/usr/bin/perl use strict; use warnings; use DateTime::Format::Pg; my $dd = DateTime::Format::Pg->parse_interval('-100:33:00'); print 'Hours: ' . $dd->hours, "\n" . 'Minutes: ' . $dd->minutes, "\n" . 'Secounds: ' . $dd->seconds, "\n"; ->hours gives 100, not -100 Thanks.
From: DMAKI [...] cpan.org
Download (untitled) / with headers
text/plain 517b
That's a feature from DateTime::Duration ;) It doesn't give you the sign when you access each component, because it normalizes the sum of each components upon creation. Try: if ($dd->is_negative) { ... duration is negative ... } else { ... duration is positive ... } Show quoted text
> my $dd = DateTime::Format::Pg->parse_interval('-100:33:00'); > > print 'Hours: ' . $dd->hours, "\n" . 'Minutes: ' . $dd->minutes, > "\n" . 'Secounds: ' . $dd->seconds, "\n"; > > > ->hours gives 100, not -100 > > Thanks.
Subject: Re: [rt.cpan.org #27222] parse_interval will not parse '-100:33:00'
Date: Tue, 22 May 2007 11:11:36 +0100 (BST)
To: bug-DateTime-Format-Pg [...] rt.cpan.org
From: "Gavin Henry" <ghenry [...] cpan.org>
Download (untitled) / with headers
text/plain 707b
<quote who="via RT"> Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=27222 > > > > That's a feature from DateTime::Duration ;) > It doesn't give you the sign when you access each component, > because it normalizes the sum of each components upon creation. > > Try: > > if ($dd->is_negative) { > ... duration is negative ... > } else { > ... duration is positive ... > }
Ah, user error ;-) Thanks for the tip and your valuable time! Gavin. Show quoted text
>
>> my $dd = DateTime::Format::Pg->parse_interval('-100:33:00'); >> >> print 'Hours: ' . $dd->hours, "\n" . 'Minutes: ' . $dd->minutes, >> "\n" . 'Secounds: ' . $dd->seconds, "\n"; >> >> >> ->hours gives 100, not -100 >> >> Thanks.
> > > >
Subject: Re: [rt.cpan.org #27222] parse_interval will not parse '-100:33:00'
Date: Tue, 22 May 2007 11:16:58 +0100 (BST)
To: bug-DateTime-Format-Pg [...] rt.cpan.org
From: "Gavin Henry" <ghenry [...] cpan.org>
Hi again, It now dies with again with '-98:08:00' on 0.16 Thanks, Gavin.
Download (untitled) / with headers
text/plain 164b
Yeah, seems like this was done intentionally (I didn't write the original code), so I missed it. I'll do a more thorough test this time ;) thanks for the feedback.
Subject: Re: [rt.cpan.org #27222] parse_interval will not parse '-100:33:00'
Date: Tue, 22 May 2007 12:15:29 +0100 (BST)
To: bug-DateTime-Format-Pg [...] rt.cpan.org
From: "Gavin Henry" <ghenry [...] cpan.org>
Download (untitled) / with headers
text/plain 262b
<quote who="via RT"> Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=27222 > > > Yeah, seems like this was done intentionally (I didn't write the > original code), so I missed it. I'll do a more thorough test this time ;) > > thanks for the feedback. >
np.
Download (untitled) / with headers
text/plain 147b
Now it should handle hours with two digits (with a preceding 0, if less than 10), or an arbitrary number of digits >= 3. Just uploaded it to CPAN.
Subject: Re: [rt.cpan.org #27222] parse_interval will not parse '-100:33:00'
Date: Tue, 22 May 2007 14:43:30 +0100 (BST)
To: bug-DateTime-Format-Pg [...] rt.cpan.org
From: "Gavin Henry" <ghenry [...] cpan.org>
Download (untitled) / with headers
text/plain 296b
<quote who="via RT"> Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=27222 > > > Now it should handle hours with two digits (with a preceding 0, if less > than 10), or an arbitrary number of digits >= 3. > > Just uploaded it to CPAN. >
Looks ok. It's handling -70:11:00. Nice work! Thanks.
From: DMAKI [...] cpan.org
Cool, will close this ticket, then.


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.