Front page | perl.perl5.porters |
Postings from February 2013
Re: File::Spec in XS
Thread Previous
|
Thread Next
From:
Craig A. Berry
Date:
February 28, 2013 18:30
Subject:
Re: File::Spec in XS
Message ID:
CA+vYcVyCLR1z9ZypUP_YKfPARy=fxX4uFYMeCRLhT-E0kux5ig@mail.gmail.com
On Thu, Feb 28, 2013 at 11:53 AM, Zefram <zefram@fysh.org> wrote:
> Craig A. Berry wrote:
>>So the code paths where invocant_is_unix() is false are still
>>File::Spec::Unix but only via inheritance?
>
> Can't quite parse your question. The invocant_is_unix() check is to
> distinguish direct use of File::Spec::Unix from inherited use of its
> methods. The code paths resulting from !invocant_is_unix() are the ones
> that play nicely in composition, specifically by calling other methods
> (that may have been overridden) rather than assuming that the methods
> would be the Unix versions.
So in your catfile implementation in the path where invocant_is_unix()
is false, you have:
+ call_method("catdir", G_SCALAR);
+ SPAGAIN;
+ dir = POPs;
+ LEAVE;
+ pv = SvPV(dir, len);
+ need_slash = len == 0 || pv[len-1] != '/';
+ RETVAL = newSVsv(dir);
Are you saying that "catdir" you're calling could be
File::Spec::VMS::catdir or File::Spec::Win32::catdir? If so, this is
completely wrong, at least in the VMS case, because there is no way to
implement catfile in terms of catdir -- file and directory syntax are
completely different. And checking for literal slashes might not do
what you expect when slashes are not the directory delimiter.
But hopefully (and more likely) I simply misunderstand how the
inheritance works.
Thread Previous
|
Thread Next