File Coverage

lib/Aspect/Pointcut.pm
Criterion Covered Total %
statement 33 37 89.1
branch 4 4 100.0
condition n/a
subroutine 13 17 76.4
pod 0 5 0.0
total 50 63 79.3


line stmt bran cond sub pod time code
1             package Aspect::Pointcut;
2              
3 1     1   5 use strict;
  1         1  
  1         29  
4 1     1   4 use warnings;
  1         1  
  1         17  
5 1     1   4 use Carp;
  1         1  
  1         44  
6 1     1   288 use Aspect::Pointcut::AndOp;
  1         2  
  1         26  
7 1     1   275 use Aspect::Pointcut::OrOp;
  1         2  
  1         41  
8 1     1   389 use Aspect::Pointcut::NotOp;
  1         2  
  1         26  
9 1     1   1365 use Data::Dumper;
  1         7809  
  1         148  
10              
11             use overload
12 2     2   20 '&' => sub { Aspect::Pointcut::AndOp->new(@_) },
13 0     0   0 '|' => sub { Aspect::Pointcut::OrOp ->new(@_) },
14 0     0   0 '!' => sub { Aspect::Pointcut::NotOp->new(@_) },
15 1     1   6 '""' => sub { Dumper [@_] };
  1     0   2  
  1         12  
  0         0  
16              
17             sub new {
18 17     17 0 5185 my ($class, @spec) = @_;
19 17         50 my $self = bless {}, $class;
20 17         84 $self->init(@spec);
21 17         239 return $self;
22             }
23              
24             sub match {
25 21934     21934 0 18619 my ($self, $spec, $sub_name) = @_;
26             return
27 21934 100       73189 ref $spec eq 'Regexp'? $sub_name =~ $spec:
    100          
28             ref $spec eq 'CODE' ? $spec->($sub_name):
29             $spec eq $sub_name;
30             }
31              
32 0     0 0 0 sub init {}
33              
34             # template methods ------------------------------------------------------------
35              
36 4868     4868 0 8472 sub match_define { 1 }
37 14     14 0 50 sub match_run { 1 }
38              
39             1;
40              
41             =head1 NAME
42              
43             Aspect::Pointcut - pointcut base class
44              
45             =head1 DESCRIPTION
46              
47             A running program can be seen as a collection of events. Events like a
48             sub returning from a call, or a package being used. These are called join
49             points. A pointcut defines a set of join points, taken from all the join
50             points in the program. Different pointcut classes allow you to define the
51             set in different ways, so you can target the exact join points you need.
52              
53             Pointcuts are constructed as trees; logical operations on pointcuts with
54             one or two arguments (not, and, or) are themselves pointcut operators.
55             You can construct them explicitly using object syntax, or you can use the
56             convenience functions exported by Aspect and the overloaded operators
57             C, C<&> and C<|>.
58              
59             =head1 SEE ALSO
60              
61             See the L pod for a guide to the Aspect module.
62              
63             =cut