File Coverage

blib/lib/XML/SAX/Tap.pm
Criterion Covered Total %
statement 18 18 100.0
branch 1 2 50.0
condition 2 3 66.6
subroutine 4 4 100.0
pod 1 1 100.0
total 26 28 92.8


line stmt bran cond sub pod time code
1             package XML::SAX::Tap;
2             {
3             $XML::SAX::Tap::VERSION = '0.46';
4             }
5             # ABSTRACT: Tap a pipeline of SAX processors
6              
7              
8 2     2   12 use base qw( XML::SAX::Machine );
  2         3  
  2         186  
9              
10              
11 2     2   10 use strict;
  2         4  
  2         55  
12 2     2   10 use Carp;
  2         3  
  2         378  
13              
14              
15             sub new {
16 2     2 1 5 my $proto = shift;
17 2 50 66     20 my $options = @_ && ref $_[-1] eq "HASH" ? pop : {};
18              
19 2         5 my $stage_number = 0;
20 2         15 my @machine_spec = (
21             [ "Intake", "XML::Filter::Tee" ],
22             map( [ "Stage_" . $stage_number++, $_ ], @_ ),
23             );
24              
25 2         8 push @{$machine_spec[$_]}, "Stage_" . $_
26 2         11 for 0..$#machine_spec-1 ;
27              
28             ## Pushing this last means that the Exhaust will get
29             ## events after Stage_0
30 2         5 push @{$machine_spec[0]}, "Exhaust";
  2         5  
31              
32 2         24 return $proto->SUPER::new( @machine_spec, $options );
33             }
34              
35              
36              
37             1;
38              
39             __END__