Prev | Gedcom.pm - Manipulating Genealogical Information | Next |
Specify which methods may be called
sub AUTOLOAD { my ($self) = @_; # don't change @_ because of the goto my $func = $AUTOLOAD; $func =~ s/^.*:://; carp "Undefined subroutine $func called" unless $Gedcom::Funcs{lc $func}; no strict "refs"; *$func = sub { my $self = shift; my ($count) = @_; my $v; if (wantarray) { return map { $_ && do { $v = $_->full_value; defined $v && length $v ? $v : $_ } } $self->record([$func, $count]); } else { my $r = $self->record([$func, $count]); return $r && do { $v = $r->full_value; defined $v && length $v ? $v : $r } } }; goto &$func }
_ and invalid tags
Slide 12 | YAPC::Europe::2003 | Copyright © 2003 Paul Johnson |