File Coverage

blib/lib/XML/XSPF/Base.pm
Criterion Covered Total %
statement 6 30 20.0
branch 0 10 0.0
condition n/a
subroutine 2 5 40.0
pod 0 1 0.0
total 8 46 17.3


line stmt bran cond sub pod time code
1             package XML::XSPF::Base;
2              
3             # $Id$
4              
5 6     6   45 use strict;
  6         16  
  6         290  
6 6     6   31 use base qw(Class::Accessor);
  6         11  
  6         12653  
7              
8             sub _getSetWithDefaults {
9 0     0     my $self = shift;
10 0           my $key = shift;
11 0           my $defaults = shift;
12              
13 0 0         if (@_) {
14 0           $self->set($key, @_);
15             }
16              
17             # Set the default version to 1 if it's not set.
18 0           my $value = $self->get($key);
19              
20 0 0         if (!defined $value) {
21 0           $value = $defaults->{$key};
22             }
23              
24 0           return $value;
25             }
26              
27             sub _asArray {
28 0     0     my $self = shift;
29 0           my $key = shift;
30              
31 0 0         if (@_) {
32              
33 0 0         if (ref($_[0]) eq 'ARRAY') {
34              
35 0           $self->set($key, @_);
36              
37             } else {
38              
39 0           $self->set($key, [ @_ ]);
40             }
41             }
42              
43 0           my $array = $self->get($key);
44              
45 0 0         if (ref($array) eq 'ARRAY') {
46              
47 0           return @{$array};
  0            
48              
49             } else {
50              
51 0           return ();
52             }
53             }
54              
55             sub append {
56 0     0 0   my $self = shift;
57 0           my $key = shift;
58              
59 0           push @{ $self->get($key) }, @_;
  0            
60             }
61              
62             1;
63              
64             __END__