File: Returning.pm

package info (click to toggle)
libaspect-perl 1.04-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 720 kB
  • sloc: perl: 6,846; makefile: 2
file content (65 lines) | stat: -rw-r--r-- 1,222 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package Aspect::Pointcut::Returning;

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

our $VERSION = '1.04';
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__

=pod

=head1 NAME

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

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

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

=head1 AUTHORS

Adam Kennedy E<lt>adamk@cpan.orgE<gt>

=head1 COPYRIGHT

Copyright 2009 - 2013 Adam Kennedy.

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut