/usr/share/perl5/Aspect/Pointcut/Throwing.pm is in libaspect-perl 1.04-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | package Aspect::Pointcut::Throwing;
use strict;
use Carp ();
use Params::Util ();
use Aspect::Pointcut ();
use Aspect::Pointcut::Not ();
use Aspect::Pointcut::Returning ();
our $VERSION = '1.04';
our @ISA = 'Aspect::Pointcut';
######################################################################
# Constructor
sub new {
my $class = shift;
my $spec = shift;
# Handle the any exception case
unless ( defined $spec ) {
return bless [
$spec,
'$Aspect::POINT->{exception}',
], $class;
}
# Handle a specific die message
if ( Params::Util::_STRING($spec) ) {
return bless [
$spec,
"Params::Util::_INSTANCE(\$Aspect::POINT->{exception}, '$spec')",
], $class;
}
# Handle a specific exception class
if ( Params::Util::_REGEX($spec) ) {
my $regex = "/$spec/";
$regex =~ s|^/\(\?([xism]*)-[xism]*:(.*)\)/\z|/$2/$1|s;
return bless [
$spec,
"defined \$Aspect::POINT->{exception} and not ref \$Aspect::POINT->{exception} and \$Aspect::POINT->{exception} =~ $regex",
], $class;
}
Carp::croak("Invalid throwing pointcut specification");
}
######################################################################
# Weaving Methods
# Exception pointcuts always match at weave time and should curry away
sub curry_weave {
return;
}
# Throwing pointcuts do not curry.
# (But maybe they should, when used with say a before {} block)
sub curry_runtime {
return $_[0];
}
sub compile_runtime {
$_[0]->[1];
}
######################################################################
# Optional XS Acceleration
BEGIN {
local $@;
eval <<'END_PERL';
use Class::XSAccessor::Array 1.08 {
replace => 1,
getters => {
'compile_runtime' => 1,
},
};
END_PERL
}
1;
__END__
=pod
=head1 NAME
Aspect::Pointcut::Throwing - Exception typing pointcut
use Aspect;
# Catch a Foo::Exception object exception
after {
$_->return_value(1)
} throwing 'Foo::Exception';
=head1 DESCRIPTION
The B<Aspect::Pointcut::Throwing> pointcut is used to match situations
in which an after() advice block wishes to intercept the throwing of a specific
exception string or object.
=head1 AUTHORS
Adam Kennedy E<lt>adamk@cpan.orgE<gt>
Marcel GrE<uuml>nauer E<lt>marcel@cpan.orgE<gt>
Ran Eilam E<lt>eilara@cpan.orgE<gt>
=head1 COPYRIGHT
Copyright 2001 by Marcel GrE<uuml>nauer
Some parts 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
|