Hi Steven,

On VMS is 'USER:[SLEMBARK.FINDBIN-LIBS-1_20]' an absolute path, i.e. is the SLEMBARK directory understood to be at the root of the USER volume? If so, probably splitpath() is actually returning the wrong result. On other platforms it returns an initial empty string to indicate an absolute path (it's kind of an historical accident, but now that's just its semantics):


% perl -MFile::Spec::Functions=:ALL -de1
...
  DB<1> x $bin = '/foo/bar/baz';
0  '/foo/bar/baz'
  DB<2> x ( $vol, $dir ) = splitpath $bin;
0  ''
1  '/foo/bar/'
  DB<3> x @subdirz = splitdir $dir;
0  ''
1  'foo'
2  'bar'
3  ''
  DB<4> x $libdir = catdir @subdirz, 'lib';
0  '/foo/bar/lib'


That empty string is the only clue catdir() gets that it should be forming an absolute path instead of a relative one.

Then we'll need to make sure catdir('', 'SLEMBARK', 'FINDBIN-LIBS-1_20', 'lib') returns the right result too, '[SLEMBARK.FINDBIN-LIBS-1_20.lib]'.

 -Ken


On Feb 8, 2006, at 6:00 PM, Steven Lembark wrote:


Notice the 6th statement adds a leading '.' to the directory.

DB<1> use File::Spec::Functions qw( splitpath splitdir catpath catdir );
  DB<2>  use FindBin;

  DB<3> x ( $bin ) = $FindBin::Bin =~ m{(.+)};
0  'USER:[SLEMBARK.FINDBIN-LIBS-1_20]'

  DB<4> x ( $vol, $dir ) = splitpath $bin;
0  'USER:'
1  '[SLEMBARK.FINDBIN-LIBS-1_20]'

  DB<5> x @subdirz = splitdir $dir;
0  'SLEMBARK'
1  'FINDBIN-LIBS-1_20'

  DB<6>  x $libdir = catdir @subdirz, 'lib';
0  '[.SLEMBARK.FINDBIN-LIBS-1_20.lib]'

  DB<7> x $path = catpath $vol, catdir @subdirz, 'lib';
0  'USER:[.SLEMBARK.FINDBIN-LIBS-1_20.lib]'


--
Steven Lembark                                       85-09 90th Street
Workhorse Computing                                Woodhaven, NY 11421
[EMAIL PROTECTED]                                     1 888 359 3508

Reply via email to