File Coverage

Caller.xs
Criterion Covered Total %
statement 10 12 83.3
branch 4 8 50.0
condition n/a
subroutine n/a
pod n/a
total 14 20 70.0


line stmt bran cond sub pod time code
1             /* -*- C -*- */
2             #include "EXTERN.h"
3             #include "perl.h"
4             #include "XSUB.h"
5              
6             MODULE = Devel::Caller PACKAGE = Devel::Caller
7              
8             SV*
9             _context_cv(context)
10             SV* context;
11             CODE:
12 8 50         PERL_CONTEXT *cx = INT2PTR(PERL_CONTEXT *, SvIV(context));
13             CV *cur_cv;
14              
15 8 50         if (CxTYPE(cx) != CXt_SUB)
16 0           croak("cx_type is %d not CXt_SUB\n", CxTYPE(cx));
17              
18 8           cur_cv = cx->blk_sub.cv;
19 8 50         if (!cur_cv)
20 0           croak("Context has no CV!\n");
21              
22 8           RETVAL = (SV*) newRV_inc( (SV*) cur_cv );
23             OUTPUT:
24             RETVAL
25              
26             SV*
27             _context_op(context)
28             SV* context;
29             CODE:
30 50 50         PERL_CONTEXT *cx = INT2PTR(PERL_CONTEXT*, SvIV(context));
31 50           OP *op = cx->blk_oldcop->op_next;
32 50           SV *rv = newSV(0);
33 50           sv_setref_iv(rv, "B::OP", PTR2IV(op));
34 50           RETVAL = rv;
35             OUTPUT:
36             RETVAL
37