| 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
| |||||||||||||||
| 20 | |||||||||||||||
| 21 | 10 | ▶ | if ( ref $class ) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 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
| |||||||||||||||
| 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
| |||||||||||||||
| 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__ | ||||||||||||||