FEAR::API #8 | FEAR::API - There's no fear with this elegant site scraper | Next >>

## Example 2 rewrite

### Old

    use WWW::Mechanize;
    use Data::Dumper;
    my $mech = WWW::Mechanize->new();
    $mech->get( "http://google.com" );
    my @link;
    foreach ($mech->links){
        if($_->[0] =~ /foo/){
           $mech->get($_->[0]);
        }
        elsif($_->[0] =~ /bar/){
           push @link;
        }
    }
    print Dumper \@link;

continued...

<< Previous | Index | Next >> | Copyright © 2006 Yung-chung Lin