ok I'm pretty much a noob here, so you have to expect some level of
stupidity... ;-)
I got this script off a site and have spent several hours trying to
fix it yet I clearly still do not understand what exactly it is doing.
To me it appears to have problems when there is "nothing" in the hash
called %links?
Here is the code:
#!/usr/bin/perl -wT
use LWP::Simple;
require HTML::Parser;
require HTML::LinkExtor;
$Domain = "mysite.com";
$URL = get("http://www.site.com");
mkdir "$Domain";
$LinkExtor = HTML::LinkExtor->new(\&links);
$LinkExtor->parse($URL);
sub links
{
($tag, %links) = @_;
if ($tag = ("a href")) {
print "$tag\n";
# if ($tag = "a href" && $links{href} =~ m/'$Domain'/) {
# if ($tag = "a href") {
$url = $links{href};
$file = $url;
$file =~ s/http:\/\/www\.//;
$file =~ s/http:\/\///g;
$file =~ tr/\//-/;
mirror ($url, "$Domain/$file.html");
print "I'm Making $file.html\n";
}
}
$url = "http://$Domain";
$file = $url;
$file =~ s/http:\/\/www\.//;
$file =~ s/http:\/\///g;
$file =~ tr/\//-/;
mirror ($url, "$Domain/$file.html");
print "Making $file.html\n";
exit;
HERE is the ERROR:
./sitesucker.pl
Use of uninitialized value in pattern match (m//) at ./sitesucker.pl
line 19.
Use of uninitialized value in pattern match (m//) at ./sitesucker.pl
line 19.
Making mypcbusa.com.html
Any help will be greatly appreciated.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/