1. Home
  2. Computing & Technology
  3. Perl

Perl Module MP3::Tag
How to edit MP3 meta tags in Perl with the MP3::Tag Perl module.

From About.com

Perl can be a great way to process your ever growing collection of MP3's - you can use it to organize them, queue them to play, or using the MP3::Tag, you can read and even edit the ID3 tags to clean them up.

First, like all non-standard Perl modules, you will need to install MP3::Tag from CPAN, and then you can include it at the top of your Perl programs with the use statement:

use MP3::Tag;
Then you can load up an MP3 file and grab the file information with some pre-made functions like autoinfo:
$mp3 = MP3::Tag->new($filename);
($title, $track, $artist, $album, $comment, $year, $genre) = $mp3->autoinfo();
Or you can use the get_tags function to grab the fill ID3 tags and read them:
$mp3->get_tags;
if (exists $mp3->{ID3v1}) {
print $mp3->{ID3v1};
}
if (exists $mp3->{ID3v2}) {
print $mp3->{ID3v2};
}
For ID3v1 and ID3v2 tags, you can even change or delete the values, giving you a powerful processing tool if you need to edit large batches of MP3 or just want to make sure your tags are nice and clean. Module Links:
  1. MP3::Tag on CPAN
  2. MP3::Tag Documentation
  3. Ilya Zakharevich
More Perl Quick Tips
Explore Perl
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Perl
  4. Programming Perl
  5. Packages & Modules
  6. Perl Module MP3::Tag - How to edit MP3 meta tags in Perl with the MP3::Tag Perl module.

©2009 About.com, a part of The New York Times Company.

All rights reserved.