Aspect-Oriented Perl - Aspect-oriented programming in pure Perl
Aspect-oriented Programming (AOP) is a programming methodology developed by Xerox PARC. The basic idea is that in complex class systems there are certain aspects or behaviors that cannot normally be expressed in a coherent, concise and precise way. One example of such aspects are design patterns, which combine various kinds of classes to produce a common type of behavior.
Aspects in Perl provide:
Dynamic enabling and disabling of aspects at run-time
Modular aspects for prepackaged functionality
See Aspect::Intro for an introduction to aspect-oriented programming. See Aspect::Overview for an overview of the modules and classes that comprise this distribution. See Aspect::Ideas for ideas on future developments. See Aspect::Cookbook for aspect-oriented recipes for common situations. See the individual modules' manpages for information on how to use and implement aspects.
Aspect::Intro
Aspect::Overview
Aspect::Ideas
Aspect::Cookbook
Many types of join points and pointcuts remain unimplemented.
Performance may suffer for aspects affecting a wide range of join points.
Aspect requires the following modules, which can be obtained from CPAN:
Aspect
Class::MethodMaker Hook::LexWrap IO::Scalar
If you install Aspect from the CPAN shell, these modules will, if necessary, be installed automatically as well.
It's all pure Perl, so just put the .pm files in their appropriate local Perl subdirectories.
The easiest way to install this distribution is using the standard build process for Perl modules:
perl Makefile.PL make make test make install
Or you could use the CPAN shell, as described in the CPAN module documentation.
CPAN
This README refers to version 0.07. For details of changes, refer to the file Changes.
README
Changes
Future versions will provide new types of join points, pointcuts and modular aspects. Stability and performance is also an ongoing concern. See Aspect::Ideas for an overview of these ideas.
The distribution has been adapted for use with perl5.8.0. Hook::LexWrap is now a core module, but there was a problem with context (wantarray) handling with Aspect::Memoize.
Hook::LexWrap
Sorry about the perl 5.6.x users, but this is bleeding-edge stuff, so you're expected to use the very latest gear. Anyway, you can still get an earlier version (up to 0.07) from CPAN, which will work with perl 5.6.x.
Aspect::Memoize is now intended for subroutines returning scalars only. That is, if the sub is called in list context, it will still only memoize, and return, a memoized scalar. Void context obviously doesn't matter when it comes to memoization; subroutines returning lists are something I have to think about.
Aspect::Memoize
Tests now use Test::More.
Test::More
Aspect has been uploaded to the CPAN.
Marcel Grünauer <marcel@cpan.org>
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.
Aspect::Intro(3pm), Aspect::Cookbook(3pm), Aspect::Ideas(3pm), Aspect(3pm).
To install Aspect, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Aspect
CPAN shell
perl -MCPAN -e shell install Aspect
For more information on module installation, please visit the detailed CPAN module installation guide.