Aspect
view release on metacpan or search on metacpan
returning
after {
print "No exception\n";
} call 'Foo::bar' & returning;
The "returning" pointcut is used with "after" advice types to indicate
the join point should only occur when a function is returning without
throwing an exception.
true
# Intercept an adjustable random percentage of calls to a function
our $RATE = 0.01;
before {
print "The few, the brave, the 1%\n";
} call 'My::foo'
& true {
rand() < $RATE
};
Because of the lengths that Aspect goes to internally to optimise the
lib/Aspect.pm view on Meta::CPAN
=cut
sub returning () {
Aspect::Pointcut::Returning->new;
}
=pod
=head2 true
# Intercept an adjustable random percentage of calls to a function
our $RATE = 0.01;
before {
print "The few, the brave, the 1%\n";
} call 'My::foo'
& true {
rand() < $RATE
};
Because of the lengths that B<Aspect> goes to internally to optimise the
( run in 0.428 second using v1.01-cache-2.11-cpan-05162d3a2b1 )