Skip to main content.
home | support | download

Back to List Archive

Re: Proposed changes to pp2html.pm and XLtoHTML.pm

From: Nick <newsgroups(at)not-real.2thebatcave.com>
Date: Wed May 11 2005 - 13:57:26 GMT
I tried this in pp2html.pm and XLtoHTML.pm, and it appears to work just
fine.  I would think it would be a good idea to provide this fix in the
next release.

>
>
> 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 Wed May 11 06:57:31 2005