NAME
Aspect::PointCut - Superclass for all types of pointcuts
SYNOPSIS
There is no synopsis, as this class is only used within Aspects; if you develop Aspect internals, you'll know how to use it. If not, you don't need to. If you're curious, read the source.
DESCRIPTION
This is the superclass for all types of pointcuts. See specific pointcuts' manpages (Aspect::PointCut::*
) for more information.
METHODS
This class inherits from Aspect::x
. In addition, it implements and/or overrides the following methods:
new([args])
-
This is the constructor. It creates the object, then calls
init()
to handle any arguments that were passed to the constructor. init([args])
-
This method initializes newly constructed objects. It doesn't do anything in this class but can be overridden in subclasses representing specific pointcuts.
spec([spec])
-
Gets, if called without an argument, or sets, if called with an argument, the pointcut specifier. See
match_define()
andmatch()
for the meaning of this specifier. match_define(joinpoint)
-
This method is called for each potential join point when enabling advice to find out whether to install the advice on that join point. Whether a join point matches at define time depends on the kind of operators a pointcut designator uses and their relationships to the type of join point in question. For example,
calls()
, which constructs a pointcut of the typeAspect::PointCut::Calls
matches call join points on subroutines whose name matches the pointcut specifier. For more on matching seematch()
.This method doesn't do anything in this class but should be overridden in subclasses.
match(arg)
-
This method can be called to find out whether the pointcut specifier matches the argument. If the specifier is a string, the argument must be equal to the string to match. If the specifier is a regular expression (constructed with
qr//
), it must match the argument. If the specifier is a coderef, the code is executed and given the argument; the argument matches if the code returns a true value.For example, the string or regular expression or coderef a
calls()
pointcut designator is constructed with is tested against the name of each call join point's subroutine to see whether to install advice code on that pointcut.
Pointcuts are constructed as trees; logical operations on pointcuts with one or two arguments (not
, and
, or
) are themselves pointcut operators. You can construct them explicitly using object syntax, or you can use the convenience functions exported by Aspect
and the overloaded operators !
, &
and |
. See the Aspect
manpage for more information.
BUGS
None known so far. If you find any bugs or oddities, please do inform the author.
AUTHOR
Marcel Grünauer <marcel@cpan.org>
COPYRIGHT
Copyright 2001-2002 Marcel Grünauer. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
perl(1), Aspect::Intro(3pm), Aspect::Overview(3pm).