File Coverage

blib/lib/AudioFile/Info/MP3/Info.pm
Criterion Covered Total %
statement 24 25 96.0
branch 1 2 50.0
condition n/a
subroutine 7 8 87.5
pod 1 1 100.0
total 33 36 91.7


line stmt bran cond sub pod time code
1             #
2             # $Id$
3             #
4              
5             =head1 NAME
6            
7             AudioFile::Info::MP3::Info - Perl extension to get info from MP3 files.
8            
9             =head1 DESCRIPTION
10            
11             This is a plugin for AudioFile::Info which uses MP3::ID3Lib to get
12             data about MP files.
13            
14             See L<AudioFile::Info> for more details.
15            
16             =cut
17              
18             package AudioFile::Info::MP3::Info;
19              
20 2     2   113321 use 5.006;
  2         6  
  2         35  
21 2     2   6 use strict;
  2         2  
  2         31  
22 2     2   5 use warnings;
  2         3  
  2         55  
23 2     2   6 use Carp;
  2         2  
  2         89  
24              
25 2     2   746 use MP3::Info;
  2         52193  
  2         353  
26              
27             my %data = (artist => 'ARTIST',
28                         title => 'TITLE',
29                         album => 'ALBUM',
30                         track => 'TRACKNUM',
31                         year => 'YEAR',
32                         genre => 'GENRE');
33              
34             sub new {
35 1     1 1 17   my $class = shift;
36 1         1   my $file = shift;
37 1         6   my $obj = MP3::Info->new($file);
38              
39 1         12284   bless { obj => $obj }, $class;
40             }
41              
42 0     0   0 sub DESTROY {}
43              
44             sub AUTOLOAD {
45 6     6   60   my $self = shift;
46              
47 6         7   our $AUTOLOAD;
48              
49 6         30   my ($pkg, $sub) = $AUTOLOAD =~ /(.+)::(\w+)/;
50              
51 6 50       17   die "Invalid attribute $sub" unless exists $data{$sub};
52              
53 6         52   return $self->{obj}->{$data{$sub}};
54             }
55              
56              
57             1;
58             __END__
59            
60             =head1 METHODS
61            
62             =head2 new
63            
64             Creates a new object of class AudioFile::Info::MP3::Info. Usually called
65             by AudioFile::Info::new.
66            
67             =head1 AUTHOR
68            
69             Dave Cross, E<lt>dave@dave.org.ukE<gt>
70            
71             =head1 COPYRIGHT AND LICENSE
72            
73             Copyright 2003 by Dave Cross
74            
75             This library is free software; you can redistribute it and/or modify
76             it under the same terms as Perl itself.
77            
78             =cut
79