[guest - Thu Dec 4 15:27:13 2003]:
Show quoted text> [guest - Thu Dec 4 15:15:36 2003]:
>
> > [PETDANCE - Sun Jul 20 17:11:15 2003]:
> >
> > > I want to be able to get all the images on a page.
>
> I think this /is/ easy. Here's a proof of concept script below. It
> requires Mech to be patched slightly to expose %urltags. Here's the
> small patch:
> ####
> --- /usr/local/lib/perl5/site_perl/5.8.0/WWW/Mechanize.pm
> +++ /home/mark/tmp/WWW/Mechanize.pm
> @@ -1269,7 +1269,8 @@
>
> =cut
>
> -my %urltags = (
> +use vars qw/%urltags/;
> +%urltags = (
> a => "href",
> area => "href",
> frame => "src",
> ###################
>
> Here's the proof of concept script:
>
> ###
>
>
> #!/usr/bin/perl
>
> use lib '/home/mark/tmp/';
> use strict;
> use WWW::Mechanize;
> use Data::Dumper;
>
> %WWW::Mechanize::urltags = (
> img => 'src',
> );
>
> my $a = WWW::Mechanize->new();
> $a->get('
http://rt.cpan.org/');
> print Dumper ( $a->links );
>
> __END__
>
> ######
>
> I'm not suggesting it implementing quite like this, just demonstrating
> the the framework is already there to make this very easy.
>
Hello,
I just ran into this issue again Today. I think the bug status should be
elevated to Normal, or even 'Important'. The documentation demonstrates
finding img links:
$mech->find_link( tag_regex => qr/^(a|img)$/
However, per the above discussion, the current code will never find any
img tags.
I think perhaps there should be some flag to include images in all of
the functions that 'find all links'. Or perhaps it would be cleaner to
just have some additional img-specific functions.