Hi, I am attempting a replica of the examples provided
with HTML::Filter. However, I cannot even get it to
act a "a slower cat". So I have two questions:
1- Why is it not even simply printing out the content
I feed into the parse() method? I know there is
content because I have been printing it all day.
2- How can I get it to print all links in the text? I
dont want to use HTML::LinkExtor because I want to get
used to using the more general tool.
Thanks. Code below:
<code>
#!/usr/local/bin/perl
use LWP::UserAgent;
$ua = new LWP::UserAgent;
# $ua->agent("$0/0.1 " . $ua->agent);
$ua->agent('Mozilla/4.0 (compatible; MSIE 5.0;
Windows 98; DigExt)');
# $ua->proxy(http =>
'http://planet.instinet.com/proxy.esn.pac');
$ua->proxy(http => 'http://esnproxy');
$ua->agent("Mozilla/8.0"); # pretend we are very
capable browser
# $req = new HTTP::Request 'GET' => 'http://spyder';
# $req = new HTTP::Request 'GET' =>
'http://128.125.104.140';
$base_url='http://toplist.island.com/toplist/top20.jsp?AH=off&frc=off';
%sort=(
'shares_traded' => 0,
'open_orders' => 3,
'net_change_desc' => 4,
'net_change_asc' => 5,
'percent_change_desc' => 6,
'percent_change_asc' => 7
);
$sort_type=
$full_url = "$base_url&SORT=$sort{sort_type}";
$req = new HTTP::Request 'GET' => "$full_url";
$req->header('Accept' => 'text/html');
# send request
$res = $ua->request($req);
# check the outcome
if ($res->is_success) {
my $content = $res->content;
# print $content;
} else {
print "Error: " . $res->status_line . "\n";
}
++$|;
package A;
require HTML::Filter;
@ISA=qw(HTML::Filter);
=head1
sub start
{
my $self = shift;
$self->{a_seen}++ if $_[0] eq "a";
$self->SUPER::start(@_);
}
sub end
{
my $self = shift;
$self->SUPER::end(@_);
$self->{a_seen}-- if $_[0] eq "a";
}
sub output
{
my $self = shift;
unless ($self->{a_seen}) {
$self->SUPER::output(@_);
}
}
=cut
$p = HTML::Filter->new->parse($content);
$p->eof;
</code>
=====
Terrence Brannon
90 St. Mark's Place
Apt. 2E North
Staten Island, NY 10301
718-448-7915
__________________________________________________
Do You Yahoo!?
Yahoo! Mail � Free email you can access from anywhere!
http://mail.yahoo.com/