Re: Problems with Parse::AFP



bauer.mail@xxxxxxxxx wrote:
use Parse::AFP;
my $afp = Parse::AFP->new('data/bigone.afp', { lazy => 1 });

dumpit($afp);

sub dumpit {

my $obj = shift;

while (my $rec = $obj->next_member) {
my $type = substr(ref($rec), 12);
print $type."\n";

if ($obj->has_members) {
dumpit($obj);
}
}
}

Without knowing anything about the Parse::AFP class, I wonder why this is a recursive routine? Wouldn't this do what you want without the recursion?

~Jeff
.



Relevant Pages

  • Re: Recurse gives me No more handles
    ... Could you replace the recursion with a loop? ... $parentcoid = shift; ... $boname = shift; ...
    (perl.dbi.users)
  • Re: Any use for recursion?
    ... If a recursive function divides a tree into two or more parts, ... a loop, without using stacks to emulate recursion, then they ... full power of the algorithm. ... (defun copy-tree (obj) ...
    (comp.programming)