Aspect::Pointcut::Returning - Function returning without exception


Aspect documentation Contained in the Aspect distribution.

Index


Code Index:

NAME

Top

Aspect::Pointcut::Returning - Function returning without exception

  use Aspect;

  # Don't trap Foo::Exception object exceptions
  after {
      $_->return_value(1)
  } call 'Foo::bar' & returning;

DESCRIPTION

Top

The Aspect::Pointcut::Returning pointcut is used to match situations in which after advice should NOT run when the function is throwing an exception.

AUTHORS

Top

Adam Kennedy <adamk@cpan.org>

COPYRIGHT

Top


Aspect documentation Contained in the Aspect distribution.

package Aspect::Pointcut::Returning;

use strict;
use warnings;
use Carp             ();
use Aspect::Pointcut ();

our $VERSION = '1.01';
our @ISA     = 'Aspect::Pointcut';





######################################################################
# Weaving Methods

# Exception pointcuts always match at weave time and should curry away
sub curry_weave {
	return;
}

# Exception-related pointcuts do not curry.
sub curry_runtime {
	return $_[0];
}

sub compile_runtime {
	'defined $Aspect::POINT->{exception} and not ref $Aspect::POINT->{exception} and $Aspect::POINT->{exception} eq ""';
}

1;

__END__