File Coverage

blib/lib/AudioFile/Info/Ogg/Vorbis/Header/PurePerl.pm
Criterion Covered Total %
statement 23 24 95.8
branch 1 2 50.0
condition n/a
subroutine 7 8 87.5
pod 1 1 100.0
total 32 35 91.4


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