Re: HTML::LinkExtor request...
Gisle Aas (aas@bergen.sn.no)
Sun, 14 Jul 1996 15:41:39 +0200
In message <m0ufAxc-001sg6C@calder.med.miami.edu>, Michael Alan Dorman writes:
> I've been working with HTML::LinkExtor over the last couple of days,
> and I must say that it's worked well (though the docs mention
> parsefile() as a method, though it should be parse_file(), right?).
Right, I'll fix that.
> My one request would be that the links() method clear the internal
> list of links. Given this behavior, a user may instantiate a single
> HTML::LinkExtor, and then just repeatedly call parse_file() and
> links() whenever necessary. I've done this by on my system by
> replacing the last line of the links() method with:
>
> splice ( @{$self->{'links'}}, 0, $#{$self->{'links'}} );
>
> I understand that this might not be appropriate default behavior, but
> that could be solved by allowing a boolean parameter to specify
> whether to clear the array.
It looks correct to let the parse_file() method clear the link list
though. Something like this perhaps:
package HTML::LinkExtor;
sub parse_file
{
my $self = shift;
$self->{links} = [];
$self->SUPER::parse_file(@_);
}
Regards,
Gisle.