in reply to Package level scope callbacks.

When you talk about package scope, do you mean you want to listen to specific call flows?

If so, then Joost is right, and this is a job for Aspect . Version 0.10 will be out today.

Here is how to print foo each time Employee::calc_* is called, but only if Company::calc_salaries exists in the call flow. So if the call flow is Test::test_employee ... Employee::calc_salary, then it will not be printed:

use Aspect; before { print 'foo' } call qr/^Employee::calc_/ & cflow company => 'Company::calc_salaries';

There is also the Listenable aspect (Aspect-0.10), for a full implementation of Observer. But because you have pointcuts, you can fire events only in some call flow. Which you cannot do with normal Observer.

Replies are listed 'Best First'.
Re^2: Package level scope callbacks.
by gaal (Parson) on Aug 01, 2004 at 12:31 UTC
    Shouldn't that be & instead of && because of overloading and stuff?