| 1 | package ExtUtils::XSpp::Exception::perlcode; | ||||||||||||||||||||||||||||
| 2 | 21 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 21 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 21 | ▶ | use base 'ExtUtils::XSpp::Exception'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | sub _dl { return defined( $_[0] ) && length( $_[0] ) ? $_[0] : undef } | ||||||||||||||||||||||||||
|
Subroutine
_dl: called CC=3 SCAR=14.2
Branch: 1 branch
Condition33%1/3
defined $_[0] and length $_[0]
MC/DC0%0/2
defined $_[0] and length $_[0]
defined $_[0]
length $_[0]
Truth table33%1/3
A and B
A= defined $_[0]B= length $_[0]
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | sub init { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=2 SCAR=7.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 9 | 1 | my $this = shift; | |||||||||||||||||||||||||||
| 10 | 1 | $this->SUPER::init(@_); | |||||||||||||||||||||||||||
| 11 | 1 | my %args = @_; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 1 | ▶ | $this->{PERL_CODE} = _dl( $args{perl_code} || $args{arg1} ); | ||||||||||||||||||||||||||
|
Condition33%1/3
$args{'perl_code'} || $args{'arg1'}
MC/DC0%0/2
$args{'perl_code'} || $args{'arg1'}
$args{'perl_code'}
$args{'arg1'}
Truth table33%1/3
A || B
A= $args{'perl_code'}B= $args{'arg1'}
| |||||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 1 | ▶ | sub handler_code { | ||||||||||||||||||||||||||
|
Subroutine
handler_code: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 17 | 1 | my $this = shift; | |||||||||||||||||||||||||||
| 18 | 1 | my $no_spaces_indent = shift; | |||||||||||||||||||||||||||
| 19 | 1 | ▶ | $no_spaces_indent = 4 if not defined $no_spaces_indent; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 1 | my $ctype = $this->cpp_type; | |||||||||||||||||||||||||||
| 22 | 1 | my $pcode = $this->{PERL_CODE}; | |||||||||||||||||||||||||||
| 23 | 1 | $pcode =~ s/^\s+//; | |||||||||||||||||||||||||||
| 24 | 1 | $pcode =~ s/\s+$//; | |||||||||||||||||||||||||||
| 25 | 1 | $pcode =~ s/\\/\\\\/g; | |||||||||||||||||||||||||||
| 26 | 1 | $pcode =~ s/"/\\"/g; | |||||||||||||||||||||||||||
| 27 | 1 | my @lines = split /\n/, $pcode; | |||||||||||||||||||||||||||
| 28 | 1 | $pcode = '"' . join(qq{"\n"}, @lines) . qq{"}; | |||||||||||||||||||||||||||
| 29 | 1 | $pcode = $this->indent_code($pcode, 4); | |||||||||||||||||||||||||||
| 30 | 1 | my $code = <<HERE; | |||||||||||||||||||||||||||
| 31 | catch ($ctype& e) { | ||||||||||||||||||||||||||||
| 32 | SV* errsv; | ||||||||||||||||||||||||||||
| 33 | SV* excsv; | ||||||||||||||||||||||||||||
| 34 | excsv = eval_pv( | ||||||||||||||||||||||||||||
| 35 | $pcode, | ||||||||||||||||||||||||||||
| 36 | 1 | ||||||||||||||||||||||||||||
| 37 | ); | ||||||||||||||||||||||||||||
| 38 | errsv = get_sv("@", TRUE); | ||||||||||||||||||||||||||||
| 39 | sv_setsv(errsv, excsv); | ||||||||||||||||||||||||||||
| 40 | croak(NULL); | ||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | HERE | ||||||||||||||||||||||||||||
| 43 | 1 | return $this->indent_code($code, $no_spaces_indent); | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 21 | 1; | |||||||||||||||||||||||||||