File Coverage

blib/lib/SMIL/Switch.pm
Criterion Covered Total %
statement 11 12 91.6
branch 1 2 50.0
condition n/a
subroutine 2 2 100.0
pod 0 1 0.0
total 14 17 82.3


line stmt bran cond sub pod time code
1             package SMIL::Switch;
2              
3             $VERSION = "0.898";
4              
5 1     1   7 use SMIL::MediaFactory;
  1         2  
  1         567  
6             @ISA = qw( SMIL::XMLContainer );
7              
8             my $item_index = "item_index";
9             my $switch = 'switch';
10              
11             sub init {
12 1     1 0 2 my $self = shift;
13 1         7 $self->SUPER::init( "switch" );
14              
15 1         2 my $switch_param = shift;
16 1         2 my $medias = shift;
17            
18 1         2 foreach $item ( @$medias ) {
19             # Check to see what this is, if it is a HASH then
20             # add it like this, otherwise trust the user
21 2         5 my $type = ref( $item );
22 2 50       8 if( ref( $item ) =~ /HASH/ ) {
23 2         12 $self->setTagContents( $self->{$item_index}++ =>
24             getMediaObject( %$item,
25             $switch =>
26             $switch_param ));
27             }
28             else {
29 0           $self->setTagContents( $self->{$item_index}++ => $item );
30             }
31             }
32             }