in reply to Rename html page titles
This code should get you started.
#!/usr/bin/perl -w use strict; use HTML::TokeParser::Simple; my $parser = HTML::TokeParser::Simple->new(\*DATA); my $new_title = 'Some title'; my $html = ''; while (defined (my $token = $parser->get_token)) { if ($token->is_start_tag('title')) { $html .= $token->as_is . $new_title; $token = $parser->get_tag('/title'); # advance to last title t +ag; } $html .= $token->as_is; } print $html; __DATA__ <html> <head> <title> This is a title </title> </head> <body> <p>This is the body</p> </body> </html>
Cheers,
Ovid
New address of my CGI Course.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Rename html page titles
by bradcathey (Prior) on Sep 03, 2003 at 21:42 UTC | |
by merlyn (Sage) on Sep 04, 2003 at 18:04 UTC |