File Coverage

blib/lib/Aspect/Pointcut/Wantarray.pm
Criterion Covered Total %
statement 31 31 100.0
branch 4 4 100.0
condition n/a
subroutine 12 12 100.0
pod 3 3 100.0
total 50 50 100.0


line stmt bran cond sub pod time code
1             package Aspect::Pointcut::Wantarray;
2              
3 21     21   79 use strict;
  21         26  
  21         540  
4 21     21   76 use warnings;
  21         27  
  21         443  
5 21     21   73 use Carp ();
  21         24  
  21         249  
6 21     21   70 use Aspect::Pointcut ();
  21         23  
  21         1104  
7              
8             our $VERSION = '0.97_06';
9             our @ISA = 'Aspect::Pointcut';
10              
11 21     21   83 use constant VOID => 1;
  21         23  
  21         1456  
12 21     21   97 use constant SCALAR => 2;
  21         46  
  21         934  
13 21     21   87 use constant LIST => 3;
  21         24  
  21         3951  
14              
15              
16              
17              
18              
19             ######################################################################
20             # Constructor Methods
21              
22             sub new {
23 32 100   32 1 400 return bless [
24             LIST,
25             '$_->{wantarray}',
26             ], $_[0] if $_[1];
27              
28 19 100       330 return bless [
29             SCALAR,
30             'defined $_->{wantarray} and not $_->{wantarray}',
31             ], $_[0] if defined $_[1];
32              
33 9         281 return bless [
34             VOID,
35             'not defined $_->{wantarray}',
36             ], $_[0];
37             }
38              
39              
40              
41              
42              
43             ######################################################################
44             # Weaving Methods
45              
46             # This is a run-time only pointcut of no value at weave time
47             sub curry_weave {
48 27     27 1 73 return;
49             }
50              
51             # For wantarray pointcuts we keep the original
52             sub curry_runtime {
53 32     32 1 88 return $_[0];
54             }
55              
56             sub compile_runtime {
57             $_[0]->[1];
58             }
59              
60              
61              
62              
63              
64             ######################################################################
65             # Optional XS Acceleration
66              
67             BEGIN {
68 21     21   38 local $@;
69 21     21   1528 eval <<'END_PERL';
  21         100  
  21         371  
  21         143  
70             use Class::XSAccessor::Array 1.08 {
71             replace => 1,
72             getters => {
73             'compile_runtime' => 1,
74             },
75             };
76             END_PERL
77             }
78              
79             1;
80              
81             __END__