Magic.pm

filter: Statementstmt 68.7% 11 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 71.4% 15 / 21 CC 1 SCAR 2.2
CC
1
Cov
69%
new
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« MagicExt.pm ↑ Summary MagicBuf.pm »
1 package ExtUtils::Typemaps::Magic;
2 1 $ExtUtils::Typemaps::Magic::VERSION = '0.009';
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use parent 'ExtUtils::Typemaps';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 sub new {
9 0 ▶ my $class = shift;
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
10 0 my $self = $class->SUPER::new(@_);
11  
12 0 $self->add_inputmap(xstype => 'T_MAGIC', code => <<'END');
13 {
14 SV* arg = $arg;
15 MAGIC* magic = SvROK(arg) && SvRMAGICAL(SvRV(arg)) ? mg_findext(SvRV(arg), PERL_MAGIC_ext, NULL) : NULL;
16 if (magic)
17 $var = ($type)magic->mg_ptr;
18 else
19 Perl_croak(aTHX_ \"%s object is lacking magic\", \"$ntype\");
20 }
21 END
22  
23 0 $self->add_outputmap(xstype => 'T_MAGIC', code => ' sv_magicext(newSVrv($arg, "$ntype"), NULL, PERL_MAGIC_ext, NULL, (const char*)$var, 0);');
24  
25 0 return $self;
26 }
27  
28 1 1;
29  
30 # ABSTRACT: Typemap for storing objects in magic
31  
32 __END__
« MagicExt.pm ↑ Summary MagicBuf.pm »