Skip Menu |

This queue is for tickets about the Genealogy-Gedcom-Date CPAN distribution.

Report information
The Basics
Id: 107400
Status: resolved
Worked: 1.5 hours (90 min)
Priority: 0/
Queue: Genealogy-Gedcom-Date

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

Bug Information
Severity: Normal
Broken in: 1.15
Fixed in: (no value)



Subject: Interesting message
I'm sometimes seeing this. I will narrow down some sample code and data as soon as I can, but in the meantime I wanted to give you a heads-up just in case it's obvious to you what's up: Argument "2-" isn't numeric in numeric ne (!=) at /home/njh/perl5/perlbrew/perls/perl-5.23.2/lib/site_perl/5.23.2/Genealogy/Gedcom/Date.pm line 617, <GEN2> line 66520. Argument "8-" isn't numeric in numeric ne (!=) at /home/njh/perl5/perlbrew/perls/perl-5.23.2/lib/site_perl/5.23.2/Genealogy/Gedcom/Date.pm line 617, <GEN2> line 66520.
Subject: Re: [rt.cpan.org #107400] Interesting message
Date: Tue, 29 Sep 2015 13:39:47 +1000
To: bug-Genealogy-Gedcom-Date [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Nigel On 29/09/15 12:51, Nigel Horne via RT wrote: Show quoted text
> Mon Sep 28 22:51:34 2015: Request 107400 was acted upon. > Transaction: Ticket created by NHORNE > Queue: Genealogy-Gedcom-Date > Subject: Interesting message > Broken in: 1.15 > Severity: Normal > Owner: Nobody > Requestors: NHORNE@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=107400 > > > > I'm sometimes seeing this. I will narrow down some sample code and data as soon as I can, but in the meantime I wanted to give you a heads-up just in case it's obvious to you what's up: > > Argument "2-" isn't numeric in numeric ne (!=) at /home/njh/perl5/perlbrew/perls/perl-5.23.2/lib/site_perl/5.23.2/Genealogy/Gedcom/Date.pm line 617, <GEN2> line 66520. > Argument "8-" isn't numeric in numeric ne (!=) at /home/njh/perl5/perlbrew/perls/perl-5.23.2/lib/site_perl/5.23.2/Genealogy/Gedcom/Date.pm line 617, <GEN2> line 66520.
Thanx for the report. Unfortunately it's at the very end of a method, so I'll have to grind thru some sample data to see what's happening. -- Ron Savage - savage.net.au
Try this program. Clearly the input is wrong and so I will fix my Gedcom, however I believe that G:G:D should more gracefully handle the problematic data giving a "Can't parse" error as it does with other errant data. #!/usr/bin/env perl use Genealogy::Gedcom::Date; my $date_parser = Genealogy::Gedcom::Date->new(); $date_parser->parse_date_value(date => 'December 13,1668');
PS: it does raise a correct error if you put a space after the comma.
Subject: Re: [rt.cpan.org #107400] Interesting message
Date: Wed, 30 Sep 2015 08:32:24 +1000
To: bug-Genealogy-Gedcom-Date [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Nigel On 30/09/15 00:38, Nigel Horne via RT wrote: Show quoted text
> Queue: Genealogy-Gedcom-Date > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=107400 > > > PS: it does raise a correct error if you put a space after the comma.
OK! Thanx for the sample code. -- Ron Savage - savage.net.au
Subject: Re: [rt.cpan.org #107400] Interesting message
Date: Wed, 30 Sep 2015 08:41:40 +1000
To: bug-Genealogy-Gedcom-Date [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Nigel On 30/09/15 00:37, Nigel Horne via RT wrote: Show quoted text
> Queue: Genealogy-Gedcom-Date > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=107400 > > > Try this program. Clearly the input is wrong and so I will fix my Gedcom, however I believe that G:G:D should more gracefully handle the problematic data giving a "Can't parse" error as it does with other errant data. > > #!/usr/bin/env perl > > use Genealogy::Gedcom::Date; > > my $date_parser = Genealogy::Gedcom::Date->new(); > > $date_parser->parse_date_value(date => 'December 13,1668');
The code zaps the comma, concatenating the 13 and the 1668. Such a 'clean-up' is used elsewhere. Next: Finding a fix. Replacing the ',' with a ' ' means the code runs successfully but does not succeed in parsing the date. I need to determine if in fact the code ought to be able to parse such a date. -- Ron Savage - savage.net.au
Subject: Re: [rt.cpan.org #107400] Interesting message
Date: Wed, 30 Sep 2015 10:36:41 +1000
To: bug-Genealogy-Gedcom-Date [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Nigel On 30/09/15 00:37, Nigel Horne via RT wrote: Show quoted text
> Queue: Genealogy-Gedcom-Date > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=107400 > > > Try this program. Clearly the input is wrong and so I will fix my Gedcom, however I believe that G:G:D should more gracefully handle the problematic data giving a "Can't parse" error as it does with other errant data. > > #!/usr/bin/env perl > > use Genealogy::Gedcom::Date; > > my $date_parser = Genealogy::Gedcom::Date->new(); > > $date_parser->parse_date_value(date => 'December 13,1668');
That's meant to fail, and is in the docs :-). (a) parse_date_value() is documented as not taking a style parameter, which is what's needed to handle this date. I may have to expand it the same way I've just expanded parse_datetime(). See below. Let me know if you need that. I was distracted by $work and should have done that in V 1.16. (b) There was a bug in the code, zapping commas in dates rather than replacing them with spaces. So, this date is seen as 'December 131668'. (c) The expansion of parse_datetime() to accept a string or a hash means it now (with the above bug fix of course) parses your date. (d) I've expanded t/date.t to test your date. (e) V 1.16 is now on CPAN. -- Ron Savage - savage.net.au
V 1.16 is on CPAN.
Subject: Re: [rt.cpan.org #107400] Interesting message
Date: Tue, 29 Sep 2015 20:48:19 -0400
To: bug-Genealogy-Gedcom-Date [...] rt.cpan.org
From: Nigel Horne <njh [...] bandsman.co.uk>
Thanks for looking into this. Actually I’m happy for it to fail to parse, in fact I would probably prefer that since it’s illegal Gedcom. However I believe it should die in a more graceful way with an ‘unable to parse’ error (which I can catch with an eval) rather than let Perl error about the illegal <= usage. -Nigel
Subject: Re: [rt.cpan.org #107400] Interesting message
Date: Wed, 30 Sep 2015 11:13:28 +1000
To: bug-Genealogy-Gedcom-Date [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Nigel On 30/09/15 10:48, njh@bandsman.co.uk via RT wrote: Show quoted text
> Queue: Genealogy-Gedcom-Date > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=107400 > > > Thanks for looking into this. > > Actually I’m happy for it to fail to parse, in fact I would probably prefer that since it’s illegal Gedcom. However I believe it should die in a more graceful way with an ‘unable to parse’ error (which I can catch with an eval) rather than let Perl error about the illegal <= usage.
Yes, the fact that it's not a Gedcom date makes me uneasy. Presumably we leave it up to the user to ensure that parseable date are not output in their original form to a gedcom file. -- Ron Savage - savage.net.au
Subject: Re: [rt.cpan.org #107400] Interesting message
Date: Tue, 29 Sep 2015 21:08:57 -0400
To: bug-Genealogy-Gedcom-Date [...] rt.cpan.org
From: Nigel Horne <njh [...] bandsman.co.uk>
Show quoted text
> On 29Sep, 2015, at 21:06, ron@savage.net.au via RT <bug-Genealogy-Gedcom-Date@rt.cpan.org> wrote: > > <URL: https://rt.cpan.org/Ticket/Display.html?id=107400 > > > Hi Nigel > > On 30/09/15 10:48, njh@bandsman.co.uk via RT wrote:
>> Queue: Genealogy-Gedcom-Date >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=107400 > >> >> Thanks for looking into this. >> >> Actually I’m happy for it to fail to parse, in fact I would probably prefer that since it’s illegal Gedcom. However I believe it should die in a more graceful way with an ‘unable to parse’ error (which I can catch with an eval) rather than let Perl error about the illegal <= usage.
> > Yes, the fact that it's not a Gedcom date makes me uneasy. > > Presumably we leave it up to the user to ensure that parseable date are > not output in their original form to a gedcom file.
Yes please, because it’s a useful side-effect of your software for me to use it to catch (and therefore correct) incorrect Gedcom data. -Nigel
Subject: Re: [rt.cpan.org #107400] Interesting message
Date: Wed, 30 Sep 2015 11:33:55 +1000
To: bug-Genealogy-Gedcom-Date [...] rt.cpan.org
From: Ron Savage <ron [...] savage.net.au>
Hi Nigel On 30/09/15 11:09, njh@bandsman.co.uk via RT wrote: Show quoted text
> Queue: Genealogy-Gedcom-Date > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=107400 > > >
>> On 29Sep, 2015, at 21:06, ron@savage.net.au via RT <bug-Genealogy-Gedcom-Date@rt.cpan.org> wrote: >> >> <URL: https://rt.cpan.org/Ticket/Display.html?id=107400 > >> >> Hi Nigel >> >> On 30/09/15 10:48, njh@bandsman.co.uk via RT wrote:
>>> Queue: Genealogy-Gedcom-Date >>> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=107400 > >>> >>> Thanks for looking into this. >>> >>> Actually I’m happy for it to fail to parse, in fact I would probably prefer that since it’s illegal Gedcom. However I believe it should die in a more graceful way with an ‘unable to parse’ error (which I can catch with an eval) rather than let Perl error about the illegal <= usage.
>> >> Yes, the fact that it's not a Gedcom date makes me uneasy. >> >> Presumably we leave it up to the user to ensure that parseable date are >> not output in their original form to a gedcom file.
> > Yes please, because it’s a useful side-effect of your software for me to use it to catch (and therefore correct) incorrect Gedcom data.
The code already does what you want. You can either call parse_date_value(date => '...') as you were, and it'll die, or you can call parse_datetime('...') or parse_datetime(date => '...'), without a style, so it defaults to 'english'. Or use style 'english or 'standard'. I.e. anything but 'american'. -- Ron Savage - savage.net.au