Gedcom.pm icon indicating copy to clipboard operation
Gedcom.pm copied to clipboard

Need help: nsfx

Open nigelhorne opened this issue 3 years ago • 1 comments

How do I get to the nsfx value of a person? I've tried these methods and none of them works:

            # $person is a 'Gedcom::Individual' object
            print $person->name(), "\n";
	my $nsfx = $person->nsfx();
	if($nsfx) {
		die $nsfx;
	}
	$nsfx = $person->tag_record('NSFX');
	if($nsfx) {
		die $nsfx;
	}
	$nsfx = $person->get_value('NSFX');
	if($nsfx) {
		die $nsfx;
	}

Here's a snippet from the Gedcom:

0 @I321@ INDI 1 NAME Arthur George /Barton/ 2 GIVN Arthur George 2 SURN Barton 2 NSFX OBE 2 _PRIM Y

nigelhorne avatar Jun 25 '22 13:06 nigelhorne

The same is true for npfx. I can't fathom how to get "Cpl" from this person.

0 @I3722@ INDI
1 NAME Henry Lewis /Horne/
2 NPFX Cpl
2 GIVN Henry Lewis
2 SURN Horne
2 _PRIM Y

nigelhorne avatar Jan 17 '24 22:01 nigelhorne

You should be able to get the two values with code such as:

my $i1   = $ged->get_individual("I321");
my $nsfx = $i1->get_value("NAME NSFX");
my $i2   = $ged->get_individual("I3722");
my $npfx = $i2->get_value("NAME NPFX");

pjcj avatar Jul 21 '24 16:07 pjcj

Yes - that works, thanks

nigelhorne avatar Jul 30 '24 21:07 nigelhorne