Front page | perl.perl5.porters |
Postings from February 2012
Re: [ext.Pod-Html.lib.Pod]Html.pm (was Re: [perl.git] branch blead,updated. v5.15.8-10-g83f6fd9)
Thread Previous
From:
Craig A. Berry
Date:
February 22, 2012 08:52
Subject:
Re: [ext.Pod-Html.lib.Pod]Html.pm (was Re: [perl.git] branch blead,updated. v5.15.8-10-g83f6fd9)
Message ID:
CA+vYcVyXcxkRUtdbcRk_m7xo5qE+3mXaWjQeV24G-QxmLot7YQ@mail.gmail.com
On Wed, Feb 22, 2012 at 4:46 AM, Nicholas Clark <nick@ccl4.org> wrote:
> On Wed, Feb 22, 2012 at 05:42:47AM +0100, Ricardo Signes wrote:
>
>> commit b581a1f73be55ae99bb4ce6f49883b0b717b5142
>> Author: Ricardo Signes <rjbs@cpan.org>
>> Date: Tue Feb 21 22:19:56 2012 -0500
>>
>> unixify the --outfile arg to pod2html
>>
>> I think we probably need a more systematic regimen of of unixify
>> calls, but for now, this gets tests passing on Win32.
>
> We might not need *any*.
>
> [Ignore drive letters for a moment]
>
> Win32 API calls and Perl internally accept '/' as a path separator.
> VMS Perl accepts Unix pathnames internally.
>
> The big reason for passing everything through File::Spec is to make native
> paths for native tools. But:
>
> Web browsers have to accept '/' pathnames in URLs. I believe (*please* check)
> that they have to accept '/' pathnames in file URLs.
>
> And IIRC drive letters end up munged anyway, as file:///C|/path/goes/here
>
> So, it's quite possible that the correct regimen is *zero*.
> All pathnames, all the time, using '/', because there are *no* native tools
> involved.
>
> If so, that would simplify things *a lot*.
This might work but it depends on how the paths are collected and
assembled. If catdir(), or catfile(), or, perhaps worst of all,
canonpath(), is used anywhere in the assembly process, then you'll
have native paths and will have to pick them apart and reassemble them
to get Unix format. If you can rely on never getting pieces of
pathnames with native delimiters in them, then you can usually get by
with File::Spec::Unix on all platforms or just directly concatenate
with slashes.
Unixification can be done portably but it isn't pretty. CPANPLUS does
it and might serve as a working example. The key point is that you
cannot call splitdir() on something that is not a directory -- you
have to call splitpath() first and then call splitdir() on only the
directory portion returned. I took a swing at what that would look
like in Pod::Html here:
<http://www.nntp.perl.org/group/perl.perl5.porters/2012/02/msg183294.html>
but while it worked on VMS it didn't on Mac OS X, and despite several
additional debugging sessions I haven't sorted out what Pod::Html is
trying to do well enough to figure out what it ought to be doing
instead.
And I think unixification is only one of the problems with Pod::Html.
One of the weird things it's doing is taking an absolute path and
trimming off the value returned by File::Spec->rootdir() from the
beginning of it. It's hard to imagine how that could reliably work
across all platforms.
Thread Previous