Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 45b98140b8e977c6a2acce4d3a698e33 > files > 31

perl-HTML-Parser-3.720.0-7.mga7.armv7hl.rpm

#!/usr/bin/perl

# This program will print out the title of an HTML document.

use strict;
use HTML::Parser ();

sub title_handler
{
    my $self = shift;
    $self->handler(text => sub { print @_ }, "dtext");
    $self->handler(end  => "eof", "self");
}

my $p = HTML::Parser->new(api_version => 3,
			  start_h => [\&title_handler, "self"],
			  report_tags => ['title'],
			 );
$p->parse_file(shift || die) || die $!;
print "\n";