File Coverage

blib/lib/SMIL/AnchoredMedia.pm
Criterion Covered Total %
statement 21 21 100.0
branch 3 6 50.0
condition 1 3 33.3
subroutine 4 4 100.0
pod 0 1 0.0
total 29 35 82.8


line stmt bran cond sub pod time code
1             package SMIL::AnchoredMedia;
2              
3             $VERSION = "0.898";
4              
5 1     1   7 use SMIL::MediaAttributes;
  1         2  
  1         232  
6 1     1   1831 use SMIL::Anchor;
  1         3  
  1         38  
7 1     1   40 use Carp;
  1         3  
  1         585  
8              
9             @ISA = qw( SMIL::XMLContainer );
10              
11             my $anchors = 'anchors';
12             my $anchors_index = 'index';
13             my $media_type = "type";
14              
15             sub init {
16 1     1 0 3 my $self = shift;
17 1         4 my %hash = @_;
18            
19 1         2 my $type = "";
20 1 50 33     6 $type = $hash{ $media_type } if
21             ( $hash{ $media_type } and $hash{ $media_type } !~ /.\/./ );
22 1 50       16 $self->SUPER::init( $type ? $type : "ref" );
23            
24             # Process the anchors here
25 1         2 my $anchors = $hash{ $anchors };
26            
27 1 50       4 croak "Creating anchor tag without any anchors, REALLY BAD!\n"
28             unless $anchors;
29            
30 1         3 foreach $anchor ( @$anchors ) {
31 1         13 $anch = new SMIL::Anchor( $anchor );
32 1         9 $self->setTagContents( $self->{$anchors_index}++ => $anch );
33             }
34            
35 1         21 my %attrs = $self->createValidAttributes( { %hash },
36             [ @mediaAttributes ] );
37            
38 1         19 $self->setAttributes( %attrs );
39             }
40              
41             1;