Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I've now made this much easier in HTML::SimpleLinkExtor 1.14:

    linktractor -f=http://www.example.com > output.txt
    No need to work too hard, after all. :)
    • Thank you. Can you see any obvious snafu's in the following code?:

      use strict;
      use warnings;
      use HTML::SimpleLinkExtor;
      use WWW::Mechanize qw( );

      #usage linkextractor -f http://www.example.com/ [example.com] > output.txt

      my ($url) = @ARGV;

      my $mech = WWW::Mechanize->new();
      my $response = $mech->get($url);
      $response->is_success()
            or die($response->status_line() . "\n");

      my $extor = HTML::SimpleLinkExtor->new();
      $extor->parse($response);
      my @all_links = $extor->links;
      foreach my $elem (@all_links) {
              print STDOUT;
      }