use Aspect? (was: Module setup argument validation)

Tom Hukins tom at eborcom.com
Tue Jul 17 00:46:00 PDT 2007


Hi, Ziya.

I like your idea of using Aspect to validate input: it fits well with
AOP's emphasis on separation of concerns.  I guess you could also use
after {} to assert that you produce the expected output.

I've used Aspect.pm quite a bit for analysing how code works (see my
slides: http://miltonkeynes.pm.org/talks/2006/10/learned_at_yapc.pdf)
but I've never used it in production.  The module itself doesn't do
anything too scary, but relies on Hook::LexWrap for its cleverness, so
any concerns about reliability and performance should focus on this.

Several people asked me after my talk how well Aspect would cope with
production code.  I don't know, as I've not tried it, but some people
seemed to think it would slow things down significantly.  I guess
Benchmark will tell you how it performs with your existing code.

You might also want to take a look at Sub::Override, or mess with
%Your::Module:: manually if you feel especially brave:
  use YAML;
  use Your::Module;
  print Dump %Your::Module::;

Good luck:  let us know how you get on.

Tom


More information about the MiltonKeynes-pm mailing list