HTML::HeadParser man page on BSDOS

Man page or keyword search:  
man Server   6284 pages
apropos Keyword Search (all sections)
Output format
BSDOS logo
[printable version]



lib::HTML::HeadUsereContributed Perl Doculib::HTML::HeadParser(3)

NAME
       HTML::HeadParser - Parse <HEAD> section of a HTML document

SYNOPSIS
	require HTML::HeadParser;
	$p = HTML::HeadParser->new;
	$p->parse($text) and  print "not finished";

	$p->header('Title')	     # to access <title>....</title>
	$p->header('Content-Base')   # to access <base href="http://...">
	$p->header('Foo')	     # to access <meta http-equiv="Foo" content="...">

DESCRIPTION
       The HTML::HeadParser is a specialized (and lightweight)
       HTML::Parser that will only parse the <HEAD>...</HEAD>
       section of a HTML document.  The parse() and parse_file()
       methods will return a FALSE value as soon as a <BODY>
       element is found, and should not be called again after
       this.

       The HTML::HeadParser constructor takes an optional
       HTTP::Headers object reference as argument.  The parser
       will update this header object as the various <HEAD>
       elements are recognized.	 If no header is given we will
       create an internal (and initially empty) header object.
       This header object can be accessed with the header()
       method.

       The following header fields are initialized from elements
       found in the <HEAD> section of the HTML document:

       Content-Base:
	   The Content-Base header is initialized from the <base
	   href="..."> element.

       Title:
	   The Title header is initialized from the
	   <title>...</title> element.

       Isindex:
	   The Isindex header will be added if there is a
	   <isindex> element in the <head>.  The header value is
	   initialized from the prompt attribute if it is
	   present.  If not prompt attribute is given it will
	   have '?' as the value.

       X-Meta-Foo
	   All <meta> elements will initialize headers with the
	   prefix "X-Meta-".  If the element contains a http-
	   equiv attribute, then it will be honored as the header
	   name.

24/Aug/1997	       perl 5.005, patch 03			1

lib::HTML::HeadUsereContributed Perl Doculib::HTML::HeadParser(3)

METHODS
       The following methods (in addition to those provided by
       the superclass) are available:

       $hp = HTML::HeadParser->new( [$header] )

       $hp->parse( $text )
	   Parses some HTML text (see HTML::Parser->parse()) but
	   will return FALSE as soon as parsing should end.

       $hp->header;
	   Returns a reference to the HTML::Header object.

       $hp->header( $key )
	   Returns a header value.

       $hp->as_string;
	   Same as $hp->header->as_string

EXAMPLES
	$h = HTTP::Headers->new;
	$p = HTML::HeadParser->new($h);
	$p->parse(<<EOT);
	<title>Stupid example</title>
	<base href="http://www.sn.no/libwww-perl/">
	Normal text starts here.
	EOT
	undef $p;
	print $h->title;   # should print "Stupid example"

SEE ALSO
       the HTML::Parser manpage, the HTTP::Headers manpage

COPYRIGHT
       Copyright 1996-1997 Gisle Aas. All rights reserved.

       This library is free software; you can redistribute it
       and/or modify it under the same terms as Perl itself.

AUTHOR
       Gisle Aas <aas@sn.no>

24/Aug/1997	       perl 5.005, patch 03			2

lib::HTML::HeadUsereContributed Perl Doculib::HTML::HeadParser(3)

24/Aug/1997	       perl 5.005, patch 03			3

[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server BSDOS

List of man pages available for BSDOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net