File Coverage

blib/lib/AudioFile/Info/Ogg/Vorbis/Header/PurePerl.pm
Criterion Covered Total %
statement 22 22 100.0
branch 1 2 50.0
condition n/a
subroutine 7 8 87.5
pod 1 1 100.0
total 31 33 93.9


line stmt bran cond sub pod time code
1             =head1 NAME
2              
3             AudioFile::Info::Ogg::Vorbis::Header::PurePerl - Perl extension to get
4             info from Ogg Vorbis files.
5              
6             =head1 DESCRIPTION
7              
8             Extracts data from an Ogg Vorbis file using the CPAN module
9             Ogg::Vorbis::Header::PurePerl.
10              
11             See L for more details.
12              
13             =cut
14              
15             package AudioFile::Info::Ogg::Vorbis::Header::PurePerl;
16              
17 1     1   751 use 5.006;
  1         4  
18 1     1   5 use strict;
  1         2  
  1         21  
19 1     1   5 use warnings;
  1         2  
  1         25  
20 1     1   6 use Carp;
  1         1  
  1         71  
21              
22 1     1   606 use Ogg::Vorbis::Header::PurePerl;
  1         2556  
  1         212  
23              
24             our $VERSION = '1.5.5';
25              
26             my %data = (artist => 'ARTIST',
27             title => 'TITLE',
28             album => 'ALBUM',
29             track => 'TRACKNUMBER',
30             year => 'DATE',
31             genre => 'GENRE');
32              
33             sub new {
34 1     1 1 18 my $class = shift;
35 1         2 my $file = shift;
36 1         5 my $obj = Ogg::Vorbis::Header::PurePerl->new($file);
37              
38 1         2936 bless { obj => $obj }, $class;
39             }
40              
41       0     sub DESTROY {}
42              
43             sub AUTOLOAD {
44 6     6   419 our $AUTOLOAD;
45              
46 6         37 my ($pkg, $sub) = $AUTOLOAD =~ /(.*)::(\w+)/;
47              
48 6 50       24 die "Invalid attribute $sub" unless $data{$sub};
49              
50 6         24 return ($_[0]->{obj}->comment($data{$sub}))[0];
51             }
52              
53              
54             1;
55             __END__