File Coverage

blib/lib/Devel/Callsite.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 15 15 100.0


line stmt bran cond sub pod time code
1             package Devel::Callsite;
2 2     2   22598 use 5.005;
  2         5  
3 2     2   10 use vars qw($VERSION);
  2         3  
  2         121  
4 2     2   8 use XSLoader;
  2         4  
  2         45  
5 2     2   10 use base qw(Exporter);
  2         2  
  2         424  
6             $VERSION = '0.10';
7             @EXPORT = qw/callsite context/;
8              
9             XSLoader::load __PACKAGE__;
10              
11             # Demo code
12             unless (caller) {
13             my $site = sub { return callsite() };
14             printf "OP location: 0x%x\n", $site->(); # prints caller OP location
15             printf "OP location: 0x%x\n", $site->(); # prints a different OP location
16              
17             print context(), "\n"; # prints the interpreter context, an unsigned number
18             }
19              
20             1;
21             __END__