in reply to Re^2: Aspect-Oriented Programming: Couple of Short Examples
in thread Aspect-Oriented Programming: Couple of Short Examples

Perhaps stereotyping the behavior of a set of methods/functions could be handled just as well by Attribute::Handlers ?

Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality

  • Comment on Re: Re^2: Aspect-Oriented Programming: Couple of Short Examples

Replies are listed 'Best First'.
Re^4: Aspect-Oriented Programming: Couple of Short Examples
by adrianh (Chancellor) on Aug 06, 2003 at 10:56 UTC

    That's certainly one approach. You could write something like:

    use My::App::Logging; .... sub foo : Logger { ... };

    and the logging functionality is encapsulated into My::App::Logging, and the attribute handler wraps the method appropriately.

    However, an AOPer would comment that you lose some of the benefits that an aspect based approach would give you:

    • You still have to add the handler to every method you want logged. If you change the policy on what should or should not be logged you still have to do a lot of manual work.
    • You lose the benefit of having the logging "aspect" documented/implemented in one place.