Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Gedcom CPAN distribution.

Report information
The Basics
Id: 45391
Status: resolved
Priority: 0/
Queue: Gedcom

People
Owner: Nobody in particular
Requestors: jik [...] kamens.brookline.ma.us
Cc:
AdminCc:

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



Subject: Gedcom gets confused when adding a NOTE record -- thinks its an xref when it isn't
When I call $record->add("NOTE", "some random text") on an individual record, Gedcom decides that I'm adding an xref rather than a textual note. Then it won't let me add a "CONT" to the note because xref note records aren't allowed to have continuation lines. I'm not sure what the "right" fix to this is, but the attached patch works.
Subject: Gedcom-1.15-xref-grammar.patch
--- Gedcom.pm~ 2009-04-23 21:10:50.000000000 -0400 +++ Gedcom.pm 2009-04-24 09:43:22.000000000 -0400 @@ -360,7 +360,7 @@ $s = $self->add_submitter; $s->add("NAME", $me); } - $l0->add("SUBM", $s->xref); + $l0->add("SUBM", $s); } $self->add_trailer unless $r->get_record("trlr"); --- Gedcom/Record.pm.orig 2009-04-24 10:20:35.000000000 -0400 +++ Gedcom/Record.pm 2009-04-24 10:21:11.000000000 -0400 @@ -143,6 +143,10 @@ } elsif (my @g = $self->{grammar}->item($args{tag})) { + if (@g > 1 and defined($args{value_is_xref})) { + my(@g2) = grep((!$args{value_is_xref} == !($_->value =~ /^<XREF:/)), @g); + @g = @g2 if (@g2); + } $self->parse($record, $g[0]); } else @@ -163,7 +167,11 @@ my @funcs = map { ref() ? $_ : split } @_; $funcs[-1] = [$funcs[-1], 0] unless ref $funcs[-1]; - my $r = $self->get_and_create(@funcs); + my %options; + if ($val) { + $options{value_is_xref} = UNIVERSAL::isa($val, "Gedcom::Record"); + } + my $r = $self->get_and_create(\%options, @funcs); if (defined $val) { @@ -205,6 +213,10 @@ sub get_and_create { my $self = shift; + my($options) = {}; + if (ref $_[0] eq "HASH") { + $options = shift; + } my @funcs = @_; my $rec = $self; @@ -235,12 +247,12 @@ if ($count < 0) { - $rec = $rec->add_record(tag => $record); + $rec = $rec->add_record(tag => $record, %{$options}); } elsif ($#records < $count) { my $new; - $new = $rec->add_record(tag => $record) for (0 .. @records - $count); + $new = $rec->add_record(tag => $record, %{$options}) for (0 .. @records - $count); $rec = $new; } else
Thanks very much for this report and patch. I've actually committed something slightly different as 0d4d967 which will be in the next release. Sorry for the delay, and thanks again.