I'm detecting either a misunderstanding or a lack of knowledge regarding the way Perl represents object references. This may help:
my $q = CGI->new; print $q; # outputs CGI=HASH(0xhhhhhhh) my $fh = IO::File->new; print $fh; # outputs IO::File=GLOB(0xhhhhhhh) # Format is: # <module-name>=<blessed-reference-type>(0x<hex-memory-location>)
Most HTML::Parser methods return an HTML::Parser object. This is what you are outputting. You'll need to supply code in order for me to supply more information :-)
I haven't used this module previously so I wrote a test script to see what's going on. I've posted it after the 'Read more ...', hopefully you'll find something useful there.
The HTML::Parser documentation includes about half-a-dozen example (working) scripts.
Here's my test script:
!#/usr/bin/perl -w use strict; use HTML::Parser (); my $html = q( <html> <head> <title>The Title</title> </head> <body> <h1>Heading 1</h1> <p>First paragraph.</p> <p><em>Second fully emphasized paragraph.</em></p> <p>Third <em>partially paragraph.</em></p> <p>Para with <strong>BOLD</strong> middle bit.</p> <p>Para with <tt>CODE - changed to TT for PM</tt> middle bit.< +/p> <ul> <li>dot point 1</li> <li>dot point 2</li> <li>dot point 3</li> </ul> </body> </html> ); my $ra_want_tags = [ qw(title h1 p em li strong) ]; my %parser_init = ( api_version => 3, text_h => [\&print_element, 'self'], report_tags => $ra_want_tags, ); my $p = HTML::Parser->new(%parser_init); do { $p->parse($html) } until ($p->eof); sub print_element { my $p = shift; $p->handler(start => sub {print map {s/^<(.+?)>$/$1: /; $_} @_}, 'text'); $p->handler(text => sub {print map {s/^\s*(.*?)\s*$/$1\n/; $_} grep /\S/, @_}, 'dt +ext'); }
PN5
In reply to Re: Re: Re: RobotUA not working
by Prior Nacre V
in thread RobotUA not working
by mkurtis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |