On OS X 10.8.4, in a test perl program:
#!/usr/bin/perl
use warnings;
use strict;
use File::BaseName;
my $fname = "/usr/local/junk.txt";
my ($name, $path, $suffix1) = File::BaseName->fileparse($fname, qr'\.[^\.]*');
Any ideas why I get the error message:
Can't locate object method "fileparse" via package "File::BaseName"
(perhaps you forgot to load "File::BaseName"?)
For that matter, why do I need to put File::BaseName
? If I don't, it says
Undefined subroutine &main::fileparse
perl -v gives:
This is perl 5, version 12, subversion 4 (v5.12.4) built for darwin-thread-multi-2level
And @INC includes /System/Library/Perl/5.12/ and /System/Library/Perl/5.12/File/BaseName.pm exists and has fileparse in it.
In case it helps, when I Use File::Spec
and refer to File::Spec->splitpath
, that works fine (but I do have to put the full line).