Hello Gisle

From: Gisle Aas <[EMAIL PROTECTED]>

Most of the time the reason to use HTML::TokeParser is to avoid
callbacks.
It's faster and no problem with filesize, (last one very important for my robot).
Please show some simple code illustrates what you try to do.

Here is:

#!/usr/bin/perl

# Libraries
use LWP;
use HTML::TokeParser;

# downd & parsing
$browser = LWP::UserAgent->new();
#my $resp = $browser->get('http://www.perl.com/', ':content_cb' => \&hola);
my $request = HTTP::Request->new('GET', 'http://www.perl.com/');
my $response = $browser->request($request,
  sub {
     my ($data, $resp) = @_;
     print length($data), " bytes.\n";
     print $data, "\n";
     my $stream = HTML::TokeParser->new($data);

     while (my $tagg = stream->get_tag('a')) {
        my $att = $tagg->[1];
        print "Found link: ", $att->{'href'},"\n";}
     return;
     },500);


Best regards:

Andres.

_________________________________________________________________
MSN. M�s �til Cada D�a http://www.msn.es/intmap/

Reply via email to