DateTime/Base.pm

filter: Statementstmt 65.6% 21 / 32 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 71.4% 5 / 7 Podpod n/a totaltotal 56.5% 26 / 46 CC 5 SCAR 21.0
CC
5
Cov
55%
_setup_column
20.0
_export_methods
2.0
_do_export
2.0
CRAP 8.2
« DateTime.pm ↑ Summary DateTime/Pg.pm »
1 # $Id: /mirror/coderepos/lang/perl/Class-DBI-Plugin-DateTime/trunk/lib/Class/DBI/Plugin/DateTime/Base.pm 101061 2009-02-20T09:44:03.572989Z daisuke $
2 #
3 # Copyright (c) 2005 Daisuke Maki <dmaki@cpan.org>
4 # All rights reserved.
5  
6 package Class::DBI::Plugin::DateTime::Base;
7 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use DateTime;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 sub import
11 2 ▶{
Subroutine import: called CC=1 SCAR=0.0
12 2 my $class = shift;
13 2 $class->SUPER::import(@_);
14  
15 2 my($caller) = caller();
16 2 $class->_do_export($caller);
17 }
18  
19 0 ▶sub _export_methods { return () }
Subroutine _export_methods: not called CC=1 SCAR=6.9
20 sub _do_export
21 2 ▶{
Subroutine _do_export: called CC=2 SCAR=6.9
22 2 my $class = shift;
23 2 my $caller = shift;
24 2 my @methods = $class->_export_methods();
25 2 foreach my $method (@methods) {
26 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
27 10 *{"${caller}::${method}"} = *{"${class}::${method}"};
28 }
29 }
30  
31 sub _setup_column
32 0 ▶{
Subroutine _setup_column: not called CC=4 SCAR=30.0
33 0 my $class = shift;
34 0 my $target = shift;
35 0 my $column = shift;
36 0 my $inflate = shift;
37 0 my $deflate = shift;
38 0 ▶ my $coltype = shift || 'DateTime';
Condition0%0/2
shift() || 'DateTime'
l!l
00
MC/DC0%0/1
shift() || 'DateTime'
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
39  
40 0 ▶ if (! $target->can('has_lazy')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($target->can("has_lazy")) 0 0 0
41 0 eval <<" EOM";
42 package $target;
43 use Class::DBI::LazyInflate;
44 EOM
45 0 ▶ die if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
46 }
47  
48 $target->has_lazy(
49 0 $column => $coltype,
50 inflate => $inflate,
51 deflate => $deflate,
52 );
53 }
54  
55 2 1;
56  
57 __END__
« DateTime.pm ↑ Summary DateTime/Pg.pm »