This bit of test code works as expected:
#!/usr/bin/perl
use Audio::TagLib;
use warnings;
use strict;
my $f = Audio::TagLib::FileRef->new("_tune.mp3");
my $artist = $f->tag()->artist();
print $artist->toCString(), "\n";
but when I put that line into a subroutine in my program:
sub dofile {
my $f = shift;
my $ft;
my $fn;
$f = $cwd . '/' . $f unless ($f =~ /^\//); # absolute path
if ($f =~ /(\.[mo][po][3g])$/) {
my $ext = $1;
$ft = Audio::Taglib::FileRef->new($f);
$fn = $ft->tag()->title();
doxfer($f, $fn . $ext );
}
}
I get this error:
Can't locate object method "new" via package "Audio::Taglib::FileRef"
(perhaps you forgot to load "Audio::Taglib::FileRef"?) at ./sndxfer line
213.
Of course I have "use Audio::TagLib;" at the beginning of my program.
What else do I need to know to use CPAN modules?
thx,
stevem