E-Bitch has asked for the wisdom of the Perl Monks concerning the following question:
When running with -w mode, I get the following errors (which I know have something to do with this, but I'm not sure what.)#!/usr/bin/perl -I/tmp/perl/libwww-perl-5.53/lib/ use 5.005; use strict; use LWP::UserAgent; use HTML::Parser; use HTML::LinkExtor; use URI; use URI::URL; my $ua = LWP::UserAgent->new; sub extractlinks { my($url, $linktype) = @_; my @sublinks = (); sub callback { my($tag, %attr) = @_; return if $tag ne $linktype; push(@sublinks, values %attr); } my $p = HTML::LinkExtor->new(\&callback); my $res = $ua->request(HTTP::Request->new(GET => $url), sub {$p->p +arse($_[0])}); my $base = $res->base; return map { $_ = url($_, $base)->abs; } @sublinks; } my @links = extractlinks("http://www.ebitch.cc", "a"); my @totallinks; push @totallinks, @links; for(my $i = 0; $i < $#links; $i++) { push @totallinks, extractlinks($links[$i], "a"); } print join("\n", @totallinks), "\n";
Variable "$linktype" will not stay shared at lnkchk.pl line 22. Variable "@sublinks" will not stay shared at lnkchk.pl line 23.
Edit: chipmunk 2001-06-27
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Subroutine not working quite right
by Abigail (Deacon) on Jun 28, 2001 at 01:26 UTC | |
|
(jeffa) Re: Subroutine not working quite right
by jeffa (Bishop) on Jun 28, 2001 at 01:25 UTC |