Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: Possible bug in HTML::Parser version 3.48: msg#00002

lang.perl.modules.lwp

Subject: Re: Possible bug in HTML::Parser version 3.48

Jack Goldstein <jackg@xxxxxxxxxx> writes:

> I've installed HTML::Parser on an AIX 5.1 system running perl 5.8.6 along
> with HTML::Tagset and all tests passed except for one relating to POD that
> was skipped. However, one of our developers found that it didn't properly
> parse titles. Here's a sample program that demonstrates the problem. When
> run with the perl 5.8.6 that I installed, the output is
>
> Help Title is
> (blank line)
>
> but when when run with a copy of perl5.8.0 that someone else installed, we
> get:
>
> Help Title is Installation Help
>
> which I assume is correct.

Thanks for your bug report. This is indeed a bug. Its cause is that
some events would trigger under certain circumstances even after a
handler has told the parser to stop with $p->eof. I've now fixed this
issue and uploaded HTML-Parser-3.49 to CPAN.

My guess would be that your perl5.8.0 installation has a version of
HTML-Parser that is older than version 3.40, where we made <title>
tags also parse in literal mode. This could explain why this issue
didn't occur with that perl installation.

> use HTML::Parser;
>
> my $title='';
>
> my $p = HTML::Parser->new(api_version => 3,);
> $p->handler(start=> \&title_handler, 'tagname, self');
> $p->parse_file("db2wi.htm");
> print "\nHelp Title is $title\n";
> exit 0;
>
> ########################################
> # Subroutines
> ########################################
> sub title_handler {
> return if shift ne 'title';
> my $self = shift;
> $self->handler(text => sub { $title= shift}, 'dtext');

BTW, HTML-Parser does not guarantee that all text between the
<title>...</title> tags are reported in a single callback, which means
this code should append to $title instead of just assigning to it.
That would make it:

$self->handler(text => sub { $title .= shift}, 'dtext');

Alternatively, set the 'unbroken_text' attribute to a TRUE value.

> $self->handler(end => sub { shift->eof if shift eq 'title' }, 'tagname,
> self');
> }

Regards,
Gisle



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
qnx.openqnx.dev...    gcc.libstdc++.c...    solaris.opensol...    information-ret...    misc.misterhous...    web.catalyst.ge...    apache.webservi...    redhat.release....    hardware.lirc/2...    kernel.autofs/2...    technology.sust...    linux.vdr/2003-...    editors.lyx.gen...    org.user-groups...    netbsd.devel.pk...    xdg.devel/2004-...    version-control...    jakarta.slide.d...    debian.packages...    creativecommons...    ports.ppc.embed...    bug-tracking.bu...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe