Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Question about MP3::Tag and undef id3v2

by tdlewis77 (Sexton)
on Sep 05, 2017 at 17:02 UTC ( [id://1198711]=note: print w/replies, xml ) Need Help??


in reply to Question about MP3::Tag and undef id3v2

Could it be because you commented out the assignment?

#                       my $id3v2 = $mp3->{ID3v2};

Replies are listed 'Best First'.
Re^2: Question about MP3::Tag and undef id3v2
by DecMoon (Novice) on Sep 05, 2017 at 17:50 UTC
    Hmm, no, it's commented because there is no id3v2 :
    $VAR1 = \undef; Can't call method "get_frame_ids" on an undefined value at ./test.pl l +ine 26.
    That's why I do my $id3v2 = exists $mp3->{ID3v2} ? $mp3->{ID3v2} : $mp3->new_tag("ID3v2");

      G'day DecMoon,

      Welcome to the Monastery.

      These are lines 25 and 26 in the code you posted:

      print Dumper(\$id3v2); print Dumper(\$id3v2->get_frame_ids);

      The first line of output you show ($VAR1 = \undef;) is telling you that $id3v2 is undef (i.e. it's undefined).

      So, "$id3v2->get_frame_ids" (in line 26) is equivalent to "undef->get_frame_ids". That's effectively what the second line of output you show is telling you.

      You'll need to do something with your assignment to $id3v2. I'm unfamiliar with the MP3::Tag module, so I'm not really in a position to advise you what that "something" might be. Options could include: checking for definedness; setting a default value; skipping some part of the code if it's not defined; or something completely different.

      — Ken

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1198711]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-19 16:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found