MagicBuf.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
« Magic.pm ↑ Summary
1 package ExtUtils::Typemaps::MagicBuf;
2 1 $ExtUtils::Typemaps::MagicBuf::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_MAGICBUF', 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_MAGICBUF', code => <<'END');
24 {
25 MAGIC* magic = sv_magicext(newSVrv($arg, "$ntype"), NULL, PERL_MAGIC_ext, NULL, (const char*)$var, 0);
26 magic->mg_len = sizeof(*$var);
27 }
28 END
29  
30 0 return $self;
31 }
32  
33 1 1;
34  
35 # ABSTRACT: Typemap for storing objects in magic buffer
36  
37 __END__
« Magic.pm ↑ Summary