File Coverage

lib/AudioFile/Info/Audio/WMA.pm
Criterion Covered Total %
statement 13 15 86.6
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 20 90.0


line stmt bran cond sub pod time code
1             =head1 NAME
2              
3             AudioFile::Info::Audio::WMA - Perl extension to get info from WMA files.
4              
5             =head1 DESCRIPTION
6              
7             This is a plugin for AudioFile::Info which uses Audio::WMMA to get
8             data about WMA files.
9              
10             See L for more details.
11              
12             =cut
13              
14             package AudioFile::Info::Audio::WMA;
15              
16 1     1   31682 use 5.006;
  1         5  
  1         41  
17              
18 1     1   7 use strict;
  1         2  
  1         40  
19 1     1   4 use warnings;
  1         7  
  1         54  
20 1     1   6 use Carp;
  1         1  
  1         105  
21              
22 1     1   471 use Audio::WMA;
  0            
  0            
23              
24             our $VERSION = 0.1;
25              
26             my %data = (
27             artist => 'ALBUMARTIST',
28             title => 'TITLE',
29             album => 'ALBUMTITLE',
30             track => 'TRACKNUMBER',
31             year => 'YEAR',
32             genre => 'GENRE',
33             );
34              
35             sub new {
36             my ($class, $file) = @_;
37              
38             my $wma = Audio::WMA->new($file);
39             bless { obj => $wma->tags }, $class;
40             }
41              
42             sub DESTROY {}
43              
44             sub AUTOLOAD {
45             my $self = shift;
46              
47             our $AUTOLOAD;
48              
49             my ($pkg, $sub) = $AUTOLOAD =~ /(.+)::(\w+)/;
50              
51             carp "Invalid attribute $sub" unless exists $data{$sub};
52              
53             return $self->{obj}->{$data{$sub}};
54             }
55              
56              
57             1;
58             __END__