File Coverage

blib/lib/DS/Transformer/Sub.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 2 2 100.0
total 23 23 100.0


line stmt bran cond sub pod time code
1             #!perl
2            
3             # ########################################################################## #
4             # Title: Sub-plug transformer
5             # Creation date: 2007-03-05
6             # Author: Michael Zedeler
7             # Description: Call sub after fetch and return result from sub as fetch result
8             # Data Stream class
9             # Data transformer
10             # File: $Source: /data/cvs/lib/DSlib/lib/DS/Transformer/Sub.pm,v $
11             # Repository: kronhjorten
12             # State: $State: Exp $
13             # Documentation: inline
14             # Recepient: -
15             # ########################################################################## #
16            
17             package DS::Transformer::Sub;
18            
19 3     3   2405 use base qw{ DS::Transformer };
  3         5  
  3         1586  
20            
21 3     3   19 use strict;
  3         5  
  3         89  
22 3     3   14 use Carp::Assert;
  3         6  
  3         16  
23            
24             our ($VERSION) = $DS::VERSION;
25             our ($REVISION) = '$Revision: 1.1 $' =~ /(\d+\.\d+)/;
26            
27            
28             sub new {
29 4     4 1 43 my( $class, $sub, $in_type, $out_type, $source, $target ) = @_;
30            
31 4         21 my $self = $class->SUPER::new( $in_type, $out_type, $source, $target );
32            
33 4         9 $self->{sub} = $sub;
34            
35 4         12 return $self;
36             }
37            
38             sub process {
39 52     52 1 64 my( $self, $row ) = @_;
40 52         56 return &{$self->{sub}}($self, $row);
  52         116  
41             }
42            
43             1;
44            
45