G
Great Deals
#!/usr/bin/perl
use HTML::LinkExtor;
$input='<a href=hreflink></a> <img src=imglink>';
getlink ('img');
getlink ('a');
sub getlink{
my $matchkey = $_[0];
print "matchkey outsite callback $matchkey \n";
sub callback {
print "matchkey inside callback $matchkey\n";
return;
}
my $p = HTML::LinkExtor->new(\&callback);
$p->parse($input);
}
The output is:
matchkey outsite callback img
matchkey inside callback img
matchkey inside callback img
matchkey outsite callback a
matchkey inside callback img
matchkey inside callback img
But it should be
matchkey outsite callback img
matchkey inside callback img
matchkey inside callback img
matchkey outsite callback a
matchkey inside callback a
matchkey inside callback a
What's wrong here?
use HTML::LinkExtor;
$input='<a href=hreflink></a> <img src=imglink>';
getlink ('img');
getlink ('a');
sub getlink{
my $matchkey = $_[0];
print "matchkey outsite callback $matchkey \n";
sub callback {
print "matchkey inside callback $matchkey\n";
return;
}
my $p = HTML::LinkExtor->new(\&callback);
$p->parse($input);
}
The output is:
matchkey outsite callback img
matchkey inside callback img
matchkey inside callback img
matchkey outsite callback a
matchkey inside callback img
matchkey inside callback img
But it should be
matchkey outsite callback img
matchkey inside callback img
matchkey inside callback img
matchkey outsite callback a
matchkey inside callback a
matchkey inside callback a
What's wrong here?