Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > I guess I don't...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 10990 of 11065
Post > Topic >>

I guess I don't understand modules

by stevem@[EMAIL PROTECTED] (Stevem) Apr 25, 2008 at 10:59 PM

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




 2 Posts in Topic:
I guess I don't understand modules
stevem@[EMAIL PROTECTED]   2008-04-25 22:59:44 
Re: I guess I don't understand modules
chas.owens@[EMAIL PROTECT  2008-04-26 06:56:03 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 15:03:11 CDT 2008.