tilly:
Thanks very much. This is an excellent solution because the code change is limited to a single line.
What used to be:
sub attachment_link_extractor
{
my ($tag, %attr) = @_;
push(@links, values %attr)
if (($tag eq 'a') &&
($attr{href} =~ m/attachments/));
}
my $p = HTML::LinkExtor->new(\&attachment_link_extractor);
...
now becomes ...
$attachment_link_extractor =
sub {
my ($tag, %attr) = @_;
push(@links, values %attr)
if (($tag eq 'a') &&
($attr{href} =~ m/attachments/));
};
my $p = HTML::LinkExtor->new($attachment_link_extractor);
The only part of the your suggested change that confused me was the need to put a semicolon after the bracket that closes the subroutine. I don't remember ever writing Perl that way before, but, I keep forgetting that the subroutine itself is part of an assignment statement.
Dave Aiello
Chatham Township Data Corporation