The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Aspect::Attribute - attribute interface to creating advice

SYNOPSIS

  use Aspect::Attribute;
  sub report : Around(qr/^Foo::/) { print "$::thisjp\n" }

DESCRIPTION

This module defines an attribute interface for creating advice. It is just another interface to aspects; you can just as well construct pointcuts and advice directly, or using the convenience functions provided by Aspect.

The universally accessible attributes defined by this module are:

:Before

This code attribute (i.e., it can only be used on subroutines) defines the subroutine as a call join point handler for the pointcut given in the attribute's argument. The argument can be a string, regex or coderef, just as calls() (from the Aspect module) accepts.

:After

This code attribute is like :Before, except that it defines the subroutine as a return join point handler.

:Around

This code attribute is like :Before, except that it defines the subroutine as both a calls and return join point handler.

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).