Skip to content

Commit

Permalink
Added some code comments and small optimisations
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Oct 26, 2024
1 parent c1761c2 commit 2bd3416
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions gedcom
Original file line number Diff line number Diff line change
Expand Up @@ -11320,20 +11320,20 @@ sub get_all_residences
return @{$all_residences{$person->xref()}};
}

my @residences = $person->residence();
my @rc;
my $index = 0;
foreach my $residence(@residences) {

for my $residence ($person->residence()) {
$index++;
if(!ref($residence)) {

# Attempt to resolve non-object residence to a Gedcom::Record object
unless (ref $residence) {
my $r = $person->tag_record('RESI', $index);
if(ref($r) eq 'Gedcom::Record') {
$residence = $r;
}
}
if(ref($residence) eq 'Gedcom::Record') {
push @rc, $residence;
$residence = $r if $r->isa('Gedcom::Record');
}

# Add valid Gedcom::Record residences to the results array
push @rc, $residence if $residence->isa('Gedcom::Record');
}
my @events = $person->event();
$index = 0;
Expand Down Expand Up @@ -13952,13 +13952,13 @@ sub get_params

# Populate %rc based on the number and type of arguments
if(($num_args == 1) && (defined $default)) {
%rc = ($default => shift);
return { $default => shift };
} elsif(($num_args % 2) == 0) {
%rc = @_;
} elsif($num_args == 1) {
Carp::croak("Usage: ", __PACKAGE__, "->", (caller(1))[3], "()");
Carp::croak('Usage: ', __PACKAGE__, '->', (caller(1))[3], '()');
} elsif($num_args == 0 && defined $default) {
Carp::croak("Usage: ", __PACKAGE__, "->", (caller(1))[3], "($default => \$val)");
Carp::croak('Usage: ', __PACKAGE__, '->', (caller(1))[3], '($default => \$val)');
}

return \%rc;
Expand Down

0 comments on commit 2bd3416

Please sign in to comment.