DS/Importer/Sub.pm

filter: Statementstmt 100% 22 / 22 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 100% 30 / 30 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« DS/TypeSpec/Any.pm ↑ Summary DS/Target/Sink.pm »
1 #!perl
2
3 # ########################################################################## #
4 # Title: Sub reference to datastream importer
5 # Creation date: 2007-03-05
6 # Author: Michael Zedeler
7 # Description: Produces a datastream from a sub reference
8 # Data Stream class
9 # Data importer
10 # File: $Source: /data/cvs/lib/DSlib/lib/DS/Importer/Sub.pm,v $
11 # Repository: kronhjorten
12 # State: $State: Exp $
13 # Documentation: inline
14 # Recepient: -
15 # ########################################################################## #
16
17 package DS::Importer::Sub;
18
19 2 ▶use base qw{ DS::Importer };
Subroutine BEGIN: called CC=1 SCAR=0.0
20
21 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶use Carp::Assert;
Subroutine BEGIN: called CC=1 SCAR=0.0
23
24 2 our ($VERSION) = $DS::VERSION;
25 2 our ($REVISION) = '$Revision: 1.1 $' =~ /(\d+\.\d+)/;
26
27
28 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
29 3 my( $class, $sub, $typespec, $target, $row ) = @_;
30
31 3 my $self = $class->SUPER::new( $typespec, $target, $row );
32 3 assert(ref($sub) eq 'CODE');
33 3 $self->{sub} = $sub;
34
35 3 return $self;
36 }
37
38 3 ▶sub _fetch {
Subroutine _fetch: called CC=1 SCAR=0.0
39 3 my($self) = @_;
40 3 return &{$self->{sub}}($self);
41 }
42
43 7 ▶sub target {
Subroutine target: called CC=1 SCAR=0.0
Pod documented
44 7 my( $self, $target ) = @_;
45 7 $self->SUPER::target( $target );
46 }
47
48 2 1;
« DS/TypeSpec/Any.pm ↑ Summary DS/Target/Sink.pm »