read-only flag

K

kielhd

Hi NG,
I would like to access a cd-rom and read the mp3-tags of the mp3-files
on the cd.
My problem seems to be that the files on the cd have a read-only flag.
The script gives me the following message:

Can't open E:\Bush - Razorblade Suitcase\02 - Greedy Fly.mp3:
Permission denied at C:/Perl/site/lib/MP3/ID3v1Tag.pm line 83.

The modul I am using looks like this around line 83 :

76 ## Constructor for Object of Module
77 sub new {
78 my($class,$mp3_file,$readonly) = @_;
79 my $self = {};
80 $readonly = 0 unless defined($readonly);
81 $self->{FileHandle} = new IO::File;
82 if( -w $mp3_file || !$readonly) {
83 $self->{FileHandle}->open("+<${mp3_file}") or (warn("Can't
open ${mp3_file}: $!") and return undef);
84 $self->{readonly} = 0;
85 } else {
86 $self->{FileHandle}->open("<${mp3_file}") or (warn("Can't open
${mp3_file}: $!") and return undef);
87 $self->{readonly} = 1;
88 }
89 $self->{filename} = $mp3_file;
90 $self->{tag} = ();
91 bless($self, ref $class || $class || $DefaultClass);
92 my $initialized = $self->init();
93 return $self;
94 }

Can somebody help me?
TIA, Henning
 
T

Terry L. Ridder

kielhd said:
Hi NG,
I would like to access a cd-rom and read the mp3-tags of the mp3-files
on the cd.
My problem seems to be that the files on the cd have a read-only flag.
The script gives me the following message:

Can't open E:\Bush - Razorblade Suitcase\02 - Greedy Fly.mp3:
Permission denied at C:/Perl/site/lib/MP3/ID3v1Tag.pm line 83.

The modul I am using looks like this around line 83 :

76 ## Constructor for Object of Module
77 sub new {
78 my($class,$mp3_file,$readonly) = @_;
79 my $self = {};
80 $readonly = 0 unless defined($readonly);
81 $self->{FileHandle} = new IO::File;
82 if( -w $mp3_file || !$readonly) {
83 $self->{FileHandle}->open("+<${mp3_file}") or (warn("Can't
open ${mp3_file}: $!") and return undef);

why are you attempting to open the mp3_file read/write if you
clearly know it is read only?

perldoc perlopentut

line 83 should be:
&self-{FileHandle}->open("<${mp3_file}") or (warn("Can not open
${mp3_file}: $!") and return undef);
 
E

Eric J. Roode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

(e-mail address removed) (kielhd) wrote in
Hi NG,
I would like to access a cd-rom and read the mp3-tags of the mp3-files
on the cd.
My problem seems to be that the files on the cd have a read-only flag.
The script gives me the following message:

Can't open E:\Bush - Razorblade Suitcase\02 - Greedy Fly.mp3:
Permission denied at C:/Perl/site/lib/MP3/ID3v1Tag.pm line 83. ....
Can somebody help me?
TIA, Henning

Use a different module?
Contact the author of this module and notify him/her of the bug?

- --
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP3ArAWPeouIeTNHoEQIcpQCg4ZuVECk3IZkM2eqkZsDoPbDFl3oAmgPk
xDeVHA6gb6Afs2vtWgnyx9E3
=Tbnr
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top