On Apr 28, 8:43 am, [EMAIL PROTECTED] (Rob Dixon) wrote:
> hotkitty wrote:
> > I'm trying to extract links from a website but get the following
> > error:
>
> > Global symbol "%Config" requires explicit package name at C:/Perl/lib/
> > Errno.pm l
> > ine 11.
> > Global symbol "%Config" requires explicit package name at C:/Perl/lib/
> > Errno.pm l
> > ine 11.
> > Global symbol "%Config" requires explicit package name at C:/Perl/lib/
> > Errno.pm l
> > ine 13.
> > Global symbol "%Config" requires explicit package name at C:/Perl/lib/
> > Errno.pm l
> > ine 13.
> > BEGIN not safe after errors--compilation aborted at C:/Perl/lib/
> > Errno.pm line 12
> > 9.
> > Compilation failed in require at C:/Perl/lib/IO/Socket.pm line 17.
> > BEGIN failed--compilation aborted at C:/Perl/lib/IO/Socket.pm line 17.
> > Compilation failed in require at C:/Perl/site/lib/LWP/Simple.pm line
> > 158.
>
> > What am I doing wrong? Here's the script (which I got from a YouTube
> > video...it seemed to work for him):
> > Thanks in advance!
>
> > #!/usr/bin/perl
> > print "Content-type: text/html\n\n";
>
> > use LWP::Simple;
> > require HTML::Parser;
> > require HTML::LinkExtor;
> > require strict;
> > use warnings;
>
> > $Domain = "ageofempires.co.nz";
> > $URL = get("http://www.ageofempires.co.nz";);
>
> > mkdir "$Domain";
>
> > $LinkExtor = HTML::LinkExtor->new(\&links);
> > $LinkExtor->parse($URL);
>
> > sub links
> > {
> >    ($tag, %links) = @_;
> >    if ($tag = "a href" &&
> >            $links{href} =~ "$Domain") {
> >    $url = $links{href};
> >    $file = $url;
> >    $file =~ s/http:\/\/www\.//;
> >    $file =~ s/http:\/\///g;
> >    $file =~ tr/\//-/;
> >    mirror ($url, "$Domain/$file.html");
> >    print "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;
>
> You have a very odd Perl program there, but it still looks like it should 
> work. The errors you are getting show that Perl hasn't been installed 
> properly, as the Errno module is failing to load Config correctly, which is 
> set up by the installation process. Try this command line
>
>   perl -MErrno -e ""
>
> and I expect you will get the same error, and if so you should arrange to 
> reinstall Perl. If not then I will have to think again!
>
> HTH,
>
> Rob- Hide quoted text -
>
> - Show quoted text -

I've fixed the issue by reinstalling PERL. However, I am now getting
the error message saying: Use of uninitialized value in pattern match
(m//) at cctest.pl line 26.
(Line 26 is "if ($tag = "a href" && "


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to