At 8:56 PM -0800 12/8/06, Peter (Stig) Edwards wrote: >Under all the versions of Perl on VMS I have available, including 5.8.7 >using the latest PathTools 3:24 all of the following print 1. > >perl -e "use File::Spec;print scalar(File::Spec->splitdir(''))" >perl -e "use File::Spec;print scalar(File::Spec->splitdir())" >perl -e "use File::Spec;print scalar(File::Spec->splitdir(undef))" > >The single element is an empty scalar.
Well, six months isn't never, but it's a long time. I finally got around to doing something about this and a variant of Stig's patch has been applied by the File::Spec maintainer: http://rt.cpan.org/Ticket/Display.html?id=27362 In the case of a CPAN module, reporting bugs directly via rt.cpan.org is often the best bet, though cc'ing vmsperl is also a good idea. > >I'm thinking I should be getting a 0 back, an empty array. (I get 0 >back from Win, Cygwin and Linux, I don't have access to a Mac, but I >suspect from looking at the code it will explicitly return the same as >VMS does?) > >Is this a bug (in VMS.pm) or might this be desired behaviour? > >>From the docs: > >>> Unlike just splitting the directories on the separator, empty >>> directory names (C<''>) can be returned, because these are significant >>> on some OSes. > >If it's a bug then this edit works for me, and all the unit tests still >pass. > >PathTools-3_24/lib/File/Spec/VMS.pm >****** > 263 $dirspec =~ tr/<>/[]/; # < and > >==> [ and ] >****** > 263 return () if ( (!defined $dirspec) || ('' eq $dirspec) ); > 264 $dirspec =~ tr/<>/[]/; # < and > >==> [ and ] >****** > >I couldn't fit a test for this into the spec.t file in an elegant way, >so here is a quick edit to test this: > >PathTools-3_24/t/spec.t >****** > 626 > 627 > 628 plan tests => scalar @tests; > 629 >****** > 626 plan tests => 1 + scalar @tests; > 627 > 628 my @got = File::Spec::VMS->splitdir(''); > 629 my $got = scalar @got; > 630 ok $got, 0, "scalar(File::Spec::VMS->splitdir(''))"; > 631 >****** > >Thanks for your thoughts, > >Peter (Stig) Edwards -- ________________________________________ Craig A. Berry mailto:[EMAIL PROTECTED] "... getting out of a sonnet is much more difficult than getting in." Brad Leithauser