blib/lib/Text/Xslate/PP/Type/Raw.pm

filter: Statementstmt 96.7% 30 / 31 Branchbran 100% 10 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 0.0% 0 / 3 totaltotal 90.3% 47 / 52 CC 6 SCAR 10.2
CC
6
Cov
98%
new
5.0
as_string
2.0
defined
2.0
CRAP 2.8
« blib/lib/Text/Xslate/PP/Method.pm ↑ Summary blib/lib/Text/Xslate/HashWithDefault.pm »
1 package Text::Xslate::PP::Type::Raw;
2  
3 190 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 190 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 190 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 190 ▶use Text::Xslate::PP::Const qw(TXt_RAW);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 190 ▶use overload (
Subroutine BEGIN: called CC=1 SCAR=0.0
10 190 '""' => 'as_string',
11 fallback => 1,
12 190 );
13  
14 190 my $the_class = TXt_RAW;
15  
16 11 ▶sub new {
Subroutine new: called CC=5 SCAR=16.1
Pod undocumented
17 11 my ( $class, $str ) = @_;
18  
19 11 ▶ Carp::croak("Usage: $the_class->new(str)") if ( @_ != 2 );
Branch: 1 branch
BranchTrueFalseTotal
if @_ != 2 1 10 11
20  
21 10 ▶ if ( ref $class ) {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $class) { } 1 9 10
elsif ($class ne $the_class) { } 1 8 9
22 1 Carp::croak("You cannot call $the_class->new() as an instance method");
23 }
24 elsif ( $class ne $the_class ) {
25 1 Carp::croak("You cannot extend $the_class ($class)");
26 }
27 8 ▶ $str = ${$str} if ref($str) eq $the_class; # unmark
Branch: 1 branch
BranchTrueFalseTotal
if ref $str eq $the_class 4 4 8
28 8 return bless \$str, $the_class;
29 }
30  
31 844 ▶sub as_string {
Subroutine as_string: called CC=2 SCAR=6.9
Pod undocumented
32 844 ▶ unless ( ref $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $_[0]) 1 843 844
33 1 Carp::croak("You cannot call $the_class->as_string() as a class method");
34 }
35 843 return ${ $_[0] };
36 }
37  
38 0 ▶sub defined { 1 }
Subroutine defined: not called CC=1 SCAR=6.9
Pod undocumented
39  
40 package
41 Text::Xslate::Type::Raw;
42 190 our @ISA = qw(Text::Xslate::PP::Type::Raw);
43 190 1;
44 __END__
« blib/lib/Text/Xslate/PP/Method.pm ↑ Summary blib/lib/Text/Xslate/HashWithDefault.pm »