[TriLUG] Perl LinkExtor
Scott Chilcote
scottchilcote at earthlink.net
Sun Dec 7 16:18:33 EST 2003
Hi Josh,
There's a functional example included in the documentation for
HTML::LinkExtor. You can get it by typing "perldoc HTML::LinkExtor", or
if you prefer a formatted web version it's here:
http://search.cpan.org/~gaas/HTML-Parser-3.34/lib/HTML/LinkExtor.pm
Someone with more LWP experience might be willing to explain why the
parse failed. Good luck.
Scott C.
Joshua Gitlin wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello TriLuggers,
>
> I'm somewhat new to Perl, and I'm trying to get a script using
> HTML::LinkExtor to work... I know I'm doing something terribly wrong.
> What I want to do is call LinkExtor->parse() on a variable containing
> HTML content with links (to extract those links). Here's my code:
>
> use LWP::Simple;
> use HTML::LinkExtor;
> use Data::Dumper;
>
> my $url = 'http://some.web.site';
>
> my $content = get $url;
>
> print("fetched $url\n");
>
> my $LinxEx = HTML::LinkExtor->new();
>
> $LinkEx->parse($content);
>
> print Dumper($LinkEX->links);
>
> When I run it, the URL is fetched, but Perl complains that I can't call
> "Parse" on an undefined value. Obviously Parse() is expecting something
> other than what I'm giving it, but I can't figure out what... And I
> can't seem to find any documentation online about how to use the Parse()
> function... Does anyone know anything about HTML:LinkExtor? Or can
> anyone point me t a good resource on the web for learning Perl (or
> something that might explain what I'm doing wrong?) Thanks in advance!
>
> - -Josh Gitlin
>
>
> - -----------
> Due to the recent increase in spam and falsely sent email, I now PGP
> Sign all of my outgoing mail to prove my identity. This means that you
> will see one of two things on all mail that you receive from me: either
> an attachment called "PGP.sig" or a block of unreadable text below this
> message.
>
> This block of encoded text (or the "PGP.sig" attachment) proves that I
> am who I say I am. If you are not familiar with PGP, you can safely
> ignore it. For more information, please visit http://www.pgp.com/ or
> http://www.gnupg.org/
>
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (Darwin)
>
> iEYEARECAAYFAj/TZYgACgkQdMO2CPVJoQ7ueQCghZ7lI5DCWS+whkbeXPPMGVfP
> ZxgAn3Doc/2Z9a2Lt325ZLAU7qBrHUve
> =bqkh
> -----END PGP SIGNATURE-----
>
More information about the TriLUG
mailing list