I am trying to download a file from a web page.
First I get the links with the linkextractor and then I want to download them with the lwp I'm a newbie programming in perl.
I made the following code ...
#!/usr/bin/perl
use strict;
use warnings;
use HTML::TableExtract;
use HTML::LinkExtractor;
use LWP::Simple qw(get);
use Archive::Zip;
my $html = get $ARGV[0];
my $te = HTML::TableExtract->new(
keep_html => 1,
headers => [qw( column1 column2 )],
);
$te->parse($html);
# I get only the first row
my ($row) = $te->rows;
my $LXM = new HTML::LinkExtractor(undef,undef,1);
$LXM->parse(\$$row[0]);
my ($t) = $LXM->links;
my $LXS = new HTML::LinkExtractor(undef,undef,1);
$LXS->parse(\$$row[1]);
my ($s) = $LXS->links;
#-------
for (my $i=0; $i < scalar(@$s); $i++) {
print "$$s[$i]{_TEXT} $$s[$i]{href} $$t[$i]{href} \n";
my $file = '/tmp/$$s[$i]{_TEXT}';
my $url = $$s[$i]{href};
my $content = getstore($url, $file);
die "Couldn't get it!" unless defined $content;
}
And I get the following error
Undefined subroutine &main::getstore called at ./geturlfromtable.pl line 35.
Thanks in advance!