Michael Peters scribbled on 5/10/05 7:49 PM:
>
> use File::Spec::splitpath() it's portable across OS'es, comes with Perl,
> and much better than trying to figure this out on your with a regex.
>
thanks, Michael. I always forget about File::Spec.
my ( $self, $doc ) = @_;
my $content = $self->run_ppthtml( $doc->fetch_filename ) || return;
# use just the file name as title with no path
my ($title) = ( $content =~ m!<title>(.*?)</title>!io );
my ($volume,$directories,$file) = File::Spec->splitpath( $title );
$content =~ s,<title>.*?</title>,<title>$file</title>,i;
# update the document's content type
$doc->set_content_type( 'text/html' );
return \$content;
--
Peter Karman . http://peknet.com/ . peter(at)not-real.peknet.com
Received on Tue May 10 17:57:21 2005