r49986 - in /branches/upstream/libaspect-perl/current: ./ lib/ lib/Aspect/ lib/Aspect/Advice/ lib/Aspect/Library/ lib/Aspect/Pointcut/ t/

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sun Jan 3 01:14:30 UTC 2010


Author: jawnsy-guest
Date: Sun Jan  3 01:14:00 2010
New Revision: 49986

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=49986
Log:
[svn-upgrade] Integrating new upstream version, libaspect-perl (0.27)

Added:
    branches/upstream/libaspect-perl/current/t/01_context.t
    branches/upstream/libaspect-perl/current/t/02_closure.t
    branches/upstream/libaspect-perl/current/t/03_main.t
    branches/upstream/libaspect-perl/current/t/04_caller.t
Removed:
    branches/upstream/libaspect-perl/current/t/01_all.t
    branches/upstream/libaspect-perl/current/t/02_caller.t
    branches/upstream/libaspect-perl/current/t/03_context.t
Modified:
    branches/upstream/libaspect-perl/current/Changes
    branches/upstream/libaspect-perl/current/MANIFEST
    branches/upstream/libaspect-perl/current/META.yml
    branches/upstream/libaspect-perl/current/lib/Aspect.pm
    branches/upstream/libaspect-perl/current/lib/Aspect/Advice.pm
    branches/upstream/libaspect-perl/current/lib/Aspect/Advice/After.pm
    branches/upstream/libaspect-perl/current/lib/Aspect/Advice/Before.pm
    branches/upstream/libaspect-perl/current/lib/Aspect/AdviceContext.pm
    branches/upstream/libaspect-perl/current/lib/Aspect/Library/Listenable.pm
    branches/upstream/libaspect-perl/current/lib/Aspect/Library/Memoize.pm
    branches/upstream/libaspect-perl/current/lib/Aspect/Library/Singleton.pm
    branches/upstream/libaspect-perl/current/lib/Aspect/Library/TestClass.pm
    branches/upstream/libaspect-perl/current/lib/Aspect/Library/Wormhole.pm
    branches/upstream/libaspect-perl/current/lib/Aspect/Modular.pm
    branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut.pm
    branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/AndOp.pm
    branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/Call.pm
    branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/Cflow.pm
    branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/NotOp.pm
    branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/OrOp.pm

Modified: branches/upstream/libaspect-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/Changes?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/Changes (original)
+++ branches/upstream/libaspect-perl/current/Changes Sun Jan  3 01:14:00 2010
@@ -1,4 +1,12 @@
 Revision history for Perl extension Aspect
+
+0.27 Sun  3 Jan 2010
+	- Various micro-optimisation of Aspect::AdviceContext which would
+	  normally be somewhat pointless, but is useful in this case when
+	  an Aspect hook is applied to something which is in the hot loop
+	  for some program.
+	- Added a test script to specifically hunt down the problems with
+	  variable sharing in string-eval'ed closures.
 
 0.26 Thu 31 Dec 2009 - Adam Kennedy
 	- With the primary internals refactoring completely, we now start

Modified: branches/upstream/libaspect-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/MANIFEST?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/MANIFEST (original)
+++ branches/upstream/libaspect-perl/current/MANIFEST Sun Jan  3 01:14:00 2010
@@ -39,9 +39,10 @@
 MANIFEST			This list of files
 META.yml
 README
-t/01_all.t
-t/02_caller.t
-t/03_context.t
+t/01_context.t
+t/02_closure.t
+t/03_main.t
+t/04_caller.t
 t/05_wantarray.t
 t/97_meta.t
 t/98_pod.t

Modified: branches/upstream/libaspect-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/META.yml?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/META.yml (original)
+++ branches/upstream/libaspect-perl/current/META.yml Sun Jan  3 01:14:00 2010
@@ -32,4 +32,4 @@
   ChangeLog: http://fisheye2.atlassian.com/changelog/cpan/trunk/Aspect
   license: http://dev.perl.org/licenses/
   repository: http://svn.ali.as/cpan/trunk/Aspect
-version: 0.26
+version: 0.27

Modified: branches/upstream/libaspect-perl/current/lib/Aspect.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/lib/Aspect.pm?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/lib/Aspect.pm (original)
+++ branches/upstream/libaspect-perl/current/lib/Aspect.pm Sun Jan  3 01:14:00 2010
@@ -21,7 +21,7 @@
 use Aspect::Pointcut::Call  ();
 use Aspect::Pointcut::Cflow ();
 
-our $VERSION = '0.26';
+our $VERSION = '0.27';
 our @ISA     = 'Exporter';
 our @EXPORT  = qw{ aspect before after call cflow };
 
@@ -609,7 +609,7 @@
 
 Copyright 2001 by Marcel GrE<uuml>nauer
 
-Some parts copyright 2009 Adam Kennedy.
+Some parts copyright 2009 - 2010 Adam Kennedy.
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.

Modified: branches/upstream/libaspect-perl/current/lib/Aspect/Advice.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/lib/Aspect/Advice.pm?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/lib/Aspect/Advice.pm (original)
+++ branches/upstream/libaspect-perl/current/lib/Aspect/Advice.pm Sun Jan  3 01:14:00 2010
@@ -7,7 +7,7 @@
 use Aspect::Advice::After  ();
 use Aspect::Advice::Before ();
 
-our $VERSION = '0.26';
+our $VERSION = '0.27';
 
 sub new {
 	my $self = bless {
@@ -102,16 +102,24 @@
 
 =head1 AUTHORS
 
+Adam Kennedy E<lt>adamk at cpan.orgE<gt>
+
 Marcel GrE<uuml>nauer E<lt>marcel at cpan.orgE<gt>
 
 Ran Eilam E<lt>eilara at cpan.orgE<gt>
+
+=head1 SEE ALSO
+
+You can find AOP examples in the C<examples/> directory of the
+distribution.
 
 =head1 COPYRIGHT AND LICENSE
 
 Copyright 2001 by Marcel GrE<uuml>nauer
 
+Some parts copyright 2009 - 2010 Adam Kennedy.
+
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut
-

Modified: branches/upstream/libaspect-perl/current/lib/Aspect/Advice/After.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/lib/Aspect/Advice/After.pm?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/lib/Aspect/Advice/After.pm (original)
+++ branches/upstream/libaspect-perl/current/lib/Aspect/Advice/After.pm Sun Jan  3 01:14:00 2010
@@ -10,7 +10,7 @@
 use Sub::Uplevel   ();
 use Aspect::Advice ();
 
-our $VERSION = '0.26';
+our $VERSION = '0.27';
 our @ISA     = 'Aspect::Advice';
 
 sub _install {

Modified: branches/upstream/libaspect-perl/current/lib/Aspect/Advice/Before.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/lib/Aspect/Advice/Before.pm?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/lib/Aspect/Advice/Before.pm (original)
+++ branches/upstream/libaspect-perl/current/lib/Aspect/Advice/Before.pm Sun Jan  3 01:14:00 2010
@@ -9,7 +9,7 @@
 use Carp            ();
 use Aspect::Advice  ();
 
-our $VERSION = '0.26';
+our $VERSION = '0.27';
 our @ISA     = 'Aspect::Advice';
 
 sub _install {

Modified: branches/upstream/libaspect-perl/current/lib/Aspect/AdviceContext.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/lib/Aspect/AdviceContext.pm?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/lib/Aspect/AdviceContext.pm (original)
+++ branches/upstream/libaspect-perl/current/lib/Aspect/AdviceContext.pm Sun Jan  3 01:14:00 2010
@@ -4,7 +4,14 @@
 use warnings;
 use Carp ();
 
-our $VERSION = '0.26';
+our $VERSION = '0.27';
+
+
+
+
+
+######################################################################
+# Constructor and Built-In Accessors
 
 sub new {
 	my $class = shift;
@@ -15,92 +22,106 @@
 	return $self;
 }
 
+sub sub_name {
+	$_[0]->{sub_name};
+}
+
+sub wantarray {
+	$_[0]->{wantarray};
+}
+
+sub proceed {
+	$_[0]->{proceed} = $_[1] if @_ > 1;
+	$_[0]->{proceed};
+}
+
+sub params_ref {
+	$_[0]->{params};
+}
+
+sub self {
+	$_[0]->{params}->[0];
+}
+
+sub params {
+	$_[0]->{params} = [ @_[1..$#_] ] if @_ > 1;
+	return CORE::wantarray
+		? @{$_[0]->{params}}
+		: $_[0]->{params};
+}
+
+sub append_param {
+	my $self = shift;
+	push @{$self->{params}}, @_;
+	return 1;
+}
+
+sub append_params {
+	shift->append_param(@_);
+}
+
+
+
+
+
+######################################################################
+# Higher Level Methods
+
+sub package_name {
+	my $self = shift;
+	my $name = $self->{sub_name};
+	return '' unless $name =~ /::/;
+	$name =~ s/::[^:]+$//;
+	return $name;
+}
+
+sub short_sub_name {
+	my $self = shift;
+	my $name = $self->{sub_name};
+	return $name unless $name =~ /::/;
+	$name =~ /::([^:]+)$/;
+	return $1;
+}
+
 sub run_original {
 	my $self     = shift;
 	my $original = $self->original;
 	my @params   = $self->params;
 	my $return_value;
-	if ( wantarray ) {
+	if ( CORE::wantarray ) {
 		$return_value = [ $original->(@params) ];
 	} else {
 		$return_value = $original->(@params);
 	}
-	$self->return_value($return_value);
-	return $self->return_value;
-}
-
-sub proceed {
-	my ($self, $value) = @_;
-	return $self->get_value('proceed') if @_ == 1;
-	$self->{proceed} = $value;
-	return $self;
-}
-
-sub append_param {
-	my ($self, @param) = @_;
-	push @{$self->params}, @param;
-	return $self;
-}
-
-sub append_params {
-	shift->append_param(@_);
-}
-
-sub params {
-	my ($self, @value) = @_;
-	return $self->get_value('params') if @_ == 1;
-	$self->{params} = \@value;
-	return $self;
-}
-
-sub params_ref {
-	$_[0]->{params};
-}
-
-sub self {
-	$_[0]->{params}->[0];
-}
-
-sub package_name {
-	my $self = shift;
-	my $name = $self->sub_name;
-	return '' unless $name =~ /::/;
-	$name =~ s/::[^:]+$//;
-	return $name;
-}
-
-sub short_sub_name {
-	my $self = shift;
-	my $name = $self->sub_name;
-	return $name unless $name =~ /::/;
-	$name =~ /::([^:]+)$/;
-	return $1;
+	return $self->return_value($return_value);
 }
 
 sub return_value {
 	my ($self, $value) = @_;
-	if (@_ == 1) {
-		my $return_value = $self->get_value('return_value');
-		return wantarray && ref $return_value eq 'ARRAY'?
-			@$return_value: $return_value;
+	if ( @_ > 1 ) {
+		$self->{return_value} = $value;
+		$self->{proceed} = 0;
 	}
-	$self->{return_value} = $value;
-	$self->{proceed} = 0;
-	return $self;
-}
-
-sub AUTOLOAD {
-	my $self = shift;
-	my $key  = our $AUTOLOAD;
-	$key =~ s/^.*:://;
-	return $self->get_value($key);
+	my $return_value = $self->get_value('return_value');
+	return (CORE::wantarray && ref $return_value eq 'ARRAY')
+		? @$return_value
+		: $return_value;
 }
 
 sub get_value {
 	my ($self, $key) = @_;
 	Carp::croak "Key does not exist: [$key]" unless exists $self->{$key};
 	my $value = $self->{$key};
-	return wantarray && ref $value eq 'ARRAY'? @$value: $value;
+	return (CORE::wantarray && ref $value eq 'ARRAY')
+		? @$value
+		: $value;
+}
+
+sub AUTOLOAD {
+	my $self = shift;
+	my $key  = our $AUTOLOAD;
+	$key =~ s/^.*:://;
+	return $self->get_value($key);
 }
 
 # Improves performance by not having to send DESTROY calls
@@ -239,16 +260,24 @@
 
 =head1 AUTHORS
 
-Marcel GrE<uuml>nauer, C<< <marcel at cpan.org> >>
-
-Ran Eilam C<< <eilara at cpan.org> >>
+Adam Kennedy E<lt>adamk at cpan.orgE<gt>
+
+Marcel GrE<uuml>nauer E<lt>marcel at cpan.orgE<gt>
+
+Ran Eilam E<lt>eilara at cpan.orgE<gt>
+
+=head1 SEE ALSO
+
+You can find AOP examples in the C<examples/> directory of the
+distribution.
 
 =head1 COPYRIGHT AND LICENSE
 
 Copyright 2001 by Marcel GrE<uuml>nauer
+
+Some parts copyright 2009 - 2010 Adam Kennedy.
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut
-

Modified: branches/upstream/libaspect-perl/current/lib/Aspect/Library/Listenable.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/lib/Aspect/Library/Listenable.pm?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/lib/Aspect/Library/Listenable.pm (original)
+++ branches/upstream/libaspect-perl/current/lib/Aspect/Library/Listenable.pm Sun Jan  3 01:14:00 2010
@@ -11,7 +11,7 @@
 use Aspect;
 use Aspect::Modular ();
 
-our $VERSION = '0.26';
+our $VERSION = '0.27';
 our @ISA     = qw{Aspect::Modular Exporter};
 our @EXPORT  = qw{add_listener remove_listener};
 
@@ -595,16 +595,24 @@
 
 =head1 AUTHORS
 
-Marcel GrE<uuml>nauer, C<< <marcel at cpan.org> >>
-
-Ran Eilam C<< <eilara at cpan.org> >>
+Adam Kennedy E<lt>adamk at cpan.orgE<gt>
+
+Marcel GrE<uuml>nauer E<lt>marcel at cpan.orgE<gt>
+
+Ran Eilam E<lt>eilara at cpan.orgE<gt>
+
+=head1 SEE ALSO
+
+You can find AOP examples in the C<examples/> directory of the
+distribution.
 
 =head1 COPYRIGHT AND LICENSE
 
 Copyright 2001 by Marcel GrE<uuml>nauer
+
+Some parts copyright 2009 - 2010 Adam Kennedy.
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut
-

Modified: branches/upstream/libaspect-perl/current/lib/Aspect/Library/Memoize.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/lib/Aspect/Library/Memoize.pm?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/lib/Aspect/Library/Memoize.pm (original)
+++ branches/upstream/libaspect-perl/current/lib/Aspect/Library/Memoize.pm Sun Jan  3 01:14:00 2010
@@ -7,7 +7,7 @@
 use Aspect;
 use Aspect::Modular ();
 
-our $VERSION = '0.26';
+our $VERSION = '0.27';
 our @ISA     = 'Aspect::Modular';
 
 sub get_advice {
@@ -78,16 +78,24 @@
 
 =head1 AUTHORS
 
-Marcel GrE<uuml>nauer, C<< <marcel at cpan.org> >>
+Adam Kennedy E<lt>adamk at cpan.orgE<gt>
 
-Ran Eilam C<< <eilara at cpan.org> >>
+Marcel GrE<uuml>nauer E<lt>marcel at cpan.orgE<gt>
+
+Ran Eilam E<lt>eilara at cpan.orgE<gt>
+
+=head1 SEE ALSO
+
+You can find AOP examples in the C<examples/> directory of the
+distribution.
 
 =head1 COPYRIGHT AND LICENSE
 
 Copyright 2001 by Marcel GrE<uuml>nauer
 
+Some parts copyright 2009 - 2010 Adam Kennedy.
+
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut
-

Modified: branches/upstream/libaspect-perl/current/lib/Aspect/Library/Singleton.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/lib/Aspect/Library/Singleton.pm?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/lib/Aspect/Library/Singleton.pm (original)
+++ branches/upstream/libaspect-perl/current/lib/Aspect/Library/Singleton.pm Sun Jan  3 01:14:00 2010
@@ -6,7 +6,7 @@
 use Aspect;
 use Aspect::Modular ();
 
-our $VERSION = '0.26';
+our $VERSION = '0.27';
 our @ISA     = 'Aspect::Modular';
 
 my %Cache;
@@ -109,14 +109,23 @@
 
 =head1 AUTHORS
 
-Marcel GrE<uuml>nauer, C<< <marcel at cpan.org> >>
+Adam Kennedy E<lt>adamk at cpan.orgE<gt>
 
-Ran Eilam C<< <eilara at cpan.org> >>
+Marcel GrE<uuml>nauer E<lt>marcel at cpan.orgE<gt>
+
+Ran Eilam E<lt>eilara at cpan.orgE<gt>
+
+=head1 SEE ALSO
+
+You can find AOP examples in the C<examples/> directory of the
+distribution.
 
 =head1 COPYRIGHT AND LICENSE
 
 Copyright 2001 by Marcel GrE<uuml>nauer
 
+Some parts copyright 2009 - 2010 Adam Kennedy.
+
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 

Modified: branches/upstream/libaspect-perl/current/lib/Aspect/Library/TestClass.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/lib/Aspect/Library/TestClass.pm?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/lib/Aspect/Library/TestClass.pm (original)
+++ branches/upstream/libaspect-perl/current/lib/Aspect/Library/TestClass.pm Sun Jan  3 01:14:00 2010
@@ -7,7 +7,7 @@
 use Aspect;
 use Aspect::Modular ();
 
-our $VERSION = '0.26';
+our $VERSION = '0.27';
 our @ISA     = 'Aspect::Modular';
 
 sub Test::Class::make_subject {
@@ -115,14 +115,23 @@
 
 =head1 AUTHORS
 
-Marcel GrE<uuml>nauer, C<< <marcel at cpan.org> >>
+Adam Kennedy E<lt>adamk at cpan.orgE<gt>
 
-Ran Eilam C<< <eilara at cpan.org> >>
+Marcel GrE<uuml>nauer E<lt>marcel at cpan.orgE<gt>
+
+Ran Eilam E<lt>eilara at cpan.orgE<gt>
+
+=head1 SEE ALSO
+
+You can find AOP examples in the C<examples/> directory of the
+distribution.
 
 =head1 COPYRIGHT AND LICENSE
 
 Copyright 2001 by Marcel GrE<uuml>nauer
 
+Some parts copyright 2009 - 2010 Adam Kennedy.
+
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 

Modified: branches/upstream/libaspect-perl/current/lib/Aspect/Library/Wormhole.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/lib/Aspect/Library/Wormhole.pm?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/lib/Aspect/Library/Wormhole.pm (original)
+++ branches/upstream/libaspect-perl/current/lib/Aspect/Library/Wormhole.pm Sun Jan  3 01:14:00 2010
@@ -6,7 +6,7 @@
 use Aspect;
 use Aspect::Modular ();
 
-our $VERSION = '0.26';
+our $VERSION = '0.27';
 our @ISA     = 'Aspect::Modular';
 
 sub get_advice {
@@ -146,14 +146,23 @@
 
 =head1 AUTHORS
 
-Marcel GrE<uuml>nauer, C<< <marcel at cpan.org> >>
+Adam Kennedy E<lt>adamk at cpan.orgE<gt>
 
-Ran Eilam C<< <eilara at cpan.org> >>
+Marcel GrE<uuml>nauer E<lt>marcel at cpan.orgE<gt>
+
+Ran Eilam E<lt>eilara at cpan.orgE<gt>
+
+=head1 SEE ALSO
+
+You can find AOP examples in the C<examples/> directory of the
+distribution.
 
 =head1 COPYRIGHT AND LICENSE
 
 Copyright 2001 by Marcel GrE<uuml>nauer
 
+Some parts copyright 2009 - 2010 Adam Kennedy.
+
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 

Modified: branches/upstream/libaspect-perl/current/lib/Aspect/Modular.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/lib/Aspect/Modular.pm?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/lib/Aspect/Modular.pm (original)
+++ branches/upstream/libaspect-perl/current/lib/Aspect/Modular.pm Sun Jan  3 01:14:00 2010
@@ -5,7 +5,7 @@
 use Carp;
 
 
-our $VERSION = '0.26';
+our $VERSION = '0.27';
 
 
 # creating --------------------------------------------------------------------
@@ -111,16 +111,19 @@
 
 =head1 AUTHORS
 
-Marcel GrE<uuml>nauer, C<< <marcel at cpan.org> >>
+Adam Kennedy E<lt>adamk at cpan.orgE<gt>
 
-Ran Eilam C<< <eilara at cpan.org> >>
+Marcel GrE<uuml>nauer E<lt>marcel at cpan.orgE<gt>
+
+Ran Eilam E<lt>eilara at cpan.orgE<gt>
 
 =head1 COPYRIGHT AND LICENSE
 
 Copyright 2001 by Marcel GrE<uuml>nauer
 
+Some parts copyright 2009 - 2010 Adam Kennedy.
+
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut
-

Modified: branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut.pm?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut.pm (original)
+++ branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut.pm Sun Jan  3 01:14:00 2010
@@ -9,7 +9,7 @@
 use Aspect::Pointcut::AndOp ();
 use Aspect::Pointcut::NotOp ();
 
-our $VERSION = '0.26';
+our $VERSION = '0.27';
 
 use overload (
 	'|'  => sub { Aspect::Pointcut::OrOp->new(@_)  },
@@ -114,16 +114,24 @@
 
 =head1 AUTHORS
 
-Marcel GrE<uuml>nauer, C<< <marcel at cpan.org> >>
+Adam Kennedy E<lt>adamk at cpan.orgE<gt>
 
-Ran Eilam C<< <eilara at cpan.org> >>
+Marcel GrE<uuml>nauer E<lt>marcel at cpan.orgE<gt>
+
+Ran Eilam E<lt>eilara at cpan.orgE<gt>
+
+=head1 SEE ALSO
+
+You can find AOP examples in the C<examples/> directory of the
+distribution.
 
 =head1 COPYRIGHT AND LICENSE
 
 Copyright 2001 by Marcel GrE<uuml>nauer
 
+Some parts copyright 2009 - 2010 Adam Kennedy.
+
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut
-

Modified: branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/AndOp.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/AndOp.pm?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/AndOp.pm (original)
+++ branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/AndOp.pm Sun Jan  3 01:14:00 2010
@@ -4,7 +4,7 @@
 use warnings;
 use Aspect::Pointcut ();
 
-our $VERSION = '0.26';
+our $VERSION = '0.27';
 our @ISA     = 'Aspect::Pointcut';
 
 sub new {
@@ -63,16 +63,24 @@
 
 =head1 AUTHORS
 
-Marcel GrE<uuml>nauer, C<< <marcel at cpan.org> >>
+Adam Kennedy E<lt>adamk at cpan.orgE<gt>
 
-Ran Eilam C<< <eilara at cpan.org> >>
+Marcel GrE<uuml>nauer E<lt>marcel at cpan.orgE<gt>
+
+Ran Eilam E<lt>eilara at cpan.orgE<gt>
+
+=head1 SEE ALSO
+
+You can find AOP examples in the C<examples/> directory of the
+distribution.
 
 =head1 COPYRIGHT AND LICENSE
 
 Copyright 2001 by Marcel GrE<uuml>nauer
 
+Some parts copyright 2009 - 2010 Adam Kennedy.
+
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut
-

Modified: branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/Call.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/Call.pm?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/Call.pm (original)
+++ branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/Call.pm Sun Jan  3 01:14:00 2010
@@ -5,7 +5,7 @@
 use Carp;
 use Aspect::Pointcut ();
 
-our $VERSION = '0.26';
+our $VERSION = '0.27';
 our @ISA     = 'Aspect::Pointcut';
 
 sub new {
@@ -54,16 +54,24 @@
 
 =head1 AUTHORS
 
-Marcel GrE<uuml>nauer, C<< <marcel at cpan.org> >>
+Adam Kennedy E<lt>adamk at cpan.orgE<gt>
 
-Ran Eilam C<< <eilara at cpan.org> >>
+Marcel GrE<uuml>nauer E<lt>marcel at cpan.orgE<gt>
+
+Ran Eilam E<lt>eilara at cpan.orgE<gt>
+
+=head1 SEE ALSO
+
+You can find AOP examples in the C<examples/> directory of the
+distribution.
 
 =head1 COPYRIGHT AND LICENSE
 
 Copyright 2001 by Marcel GrE<uuml>nauer
 
+Some parts copyright 2009 - 2010 Adam Kennedy.
+
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut
-

Modified: branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/Cflow.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/Cflow.pm?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/Cflow.pm (original)
+++ branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/Cflow.pm Sun Jan  3 01:14:00 2010
@@ -6,7 +6,7 @@
 use Aspect::Pointcut      ();
 use Aspect::AdviceContext ();
 
-our $VERSION = '0.26';
+our $VERSION = '0.27';
 our @ISA     = 'Aspect::Pointcut';
 
 sub new {
@@ -95,16 +95,24 @@
 
 =head1 AUTHORS
 
-Marcel GrE<uuml>nauer, C<< <marcel at cpan.org> >>
+Adam Kennedy E<lt>adamk at cpan.orgE<gt>
 
-Ran Eilam C<< <eilara at cpan.org> >>
+Marcel GrE<uuml>nauer E<lt>marcel at cpan.orgE<gt>
+
+Ran Eilam E<lt>eilara at cpan.orgE<gt>
+
+=head1 SEE ALSO
+
+You can find AOP examples in the C<examples/> directory of the
+distribution.
 
 =head1 COPYRIGHT AND LICENSE
 
 Copyright 2001 by Marcel GrE<uuml>nauer
 
+Some parts copyright 2009 - 2010 Adam Kennedy.
+
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut
-

Modified: branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/NotOp.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/NotOp.pm?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/NotOp.pm (original)
+++ branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/NotOp.pm Sun Jan  3 01:14:00 2010
@@ -4,7 +4,7 @@
 use warnings;
 use Aspect::Pointcut ();
 
-our $VERSION = '0.26';
+our $VERSION = '0.27';
 our @ISA     = 'Aspect::Pointcut';
 
 sub new {
@@ -56,16 +56,24 @@
 
 =head1 AUTHORS
 
-Marcel GrE<uuml>nauer, C<< <marcel at cpan.org> >>
+Adam Kennedy E<lt>adamk at cpan.orgE<gt>
 
-Ran Eilam C<< <eilara at cpan.org> >>
+Marcel GrE<uuml>nauer E<lt>marcel at cpan.orgE<gt>
+
+Ran Eilam E<lt>eilara at cpan.orgE<gt>
+
+=head1 SEE ALSO
+
+You can find AOP examples in the C<examples/> directory of the
+distribution.
 
 =head1 COPYRIGHT AND LICENSE
 
 Copyright 2001 by Marcel GrE<uuml>nauer
 
+Some parts copyright 2009 - 2010 Adam Kennedy.
+
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut
-

Modified: branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/OrOp.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/OrOp.pm?rev=49986&op=diff
==============================================================================
--- branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/OrOp.pm (original)
+++ branches/upstream/libaspect-perl/current/lib/Aspect/Pointcut/OrOp.pm Sun Jan  3 01:14:00 2010
@@ -4,7 +4,7 @@
 use warnings;
 use Aspect::Pointcut ();
 
-our $VERSION = '0.26';
+our $VERSION = '0.27';
 our @ISA     = 'Aspect::Pointcut';
 
 sub new {
@@ -63,16 +63,24 @@
 
 =head1 AUTHORS
 
-Marcel GrE<uuml>nauer, C<< <marcel at cpan.org> >>
+Adam Kennedy E<lt>adamk at cpan.orgE<gt>
 
-Ran Eilam C<< <eilara at cpan.org> >>
+Marcel GrE<uuml>nauer E<lt>marcel at cpan.orgE<gt>
+
+Ran Eilam E<lt>eilara at cpan.orgE<gt>
+
+=head1 SEE ALSO
+
+You can find AOP examples in the C<examples/> directory of the
+distribution.
 
 =head1 COPYRIGHT AND LICENSE
 
 Copyright 2001 by Marcel GrE<uuml>nauer
 
+Some parts copyright 2009 - 2010 Adam Kennedy.
+
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
 
 =cut
-

Added: branches/upstream/libaspect-perl/current/t/01_context.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/t/01_context.t?rev=49986&op=file
==============================================================================
--- branches/upstream/libaspect-perl/current/t/01_context.t (added)
+++ branches/upstream/libaspect-perl/current/t/01_context.t Sun Jan  3 01:14:00 2010
@@ -1,0 +1,70 @@
+#!/usr/bin/perl
+
+# Validates some assumptions built into the Aspect code about how context
+# and return work.
+
+use strict;
+BEGIN {
+	$|  = 1;
+	$^W = 1;
+}
+use Test::More tests => 28;
+use Test::NoWarnings;
+
+my $array  = 0;
+my $scalar = 0;
+my $void   = 0;
+
+sub test {
+	is( $array,  $_[0], "\$array = $_[0]"  );
+	is( $scalar, $_[1], "\$scalar = $_[1]" );
+	is( $void,   $_[2], "\$void = $_[2]"   );
+}
+
+# Direct usage
+test( 1, 0, 0, context() );
+test( 1, 1, 0, scalar(context()) );
+context();
+test( 1, 1, 1 );
+
+# Plain single indirection
+test( 2, 1, 1, one() );
+test( 2, 2, 1, scalar(one()) );
+one();
+test( 2, 2, 2 );
+
+# Plain explicit indirection
+test( 3, 2, 2, two() );
+test( 3, 3, 2, scalar(two()) );
+two();
+test( 3, 3, 3 );
+
+
+
+
+
+######################################################################
+# Test Functions
+
+sub one {
+	context();
+}
+
+sub two {
+	return context();
+}
+
+sub context {
+	if ( wantarray ) {
+		$array++;
+		return 'foo';
+	} elsif ( defined wantarray ) {
+		$scalar++;
+		return 'bar';
+	} else {
+		$void++;
+		return 'baz';
+	}
+}
+
+1;

Added: branches/upstream/libaspect-perl/current/t/02_closure.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/t/02_closure.t?rev=49986&op=file
==============================================================================
--- branches/upstream/libaspect-perl/current/t/02_closure.t (added)
+++ branches/upstream/libaspect-perl/current/t/02_closure.t Sun Jan  3 01:14:00 2010
@@ -1,0 +1,71 @@
+#!/usr/bin/perl
+
+# Validates that the type of closures used in Aspect.pm work properly on every
+# Perl version we care about.
+
+use strict;
+BEGIN {
+	$|  = 1;
+	$^W = 1;
+}
+use Test::More tests => 24;
+use Test::NoWarnings;
+
+# Create the subroutine we plan to replace
+my $foo = 0;
+sub foo () {
+	++$foo;
+}
+is( foo(), 1, 'foo() ok' );
+is( $foo,  1, '$foo ok'  );
+is( foo(), 2, 'foo() ok' );
+is( $foo,  2, '$foo ok'  );
+
+# Test the creation of an anonymous sub with a prototype
+my $anon1 = sub () {
+	$foo += 2;
+};
+is( $anon1->(), 4, 'foo() ok' );
+is( $foo, 4, '$foo ok'  );
+is( $anon1->(), 6, 'foo() ok' );
+is( $foo, 6, '$foo ok'  );
+
+# Replace the function
+eval <<'END_PERL';
+no warnings 'redefine';
+sub foo () {
+	$foo += 3;
+}
+END_PERL
+is( $@, '', 'Built new function without error' );
+is( foo(), 9, 'foo() ok' );
+is( $foo, 9, '$foo ok'  );
+is( foo(), 12, 'foo() ok' );
+is( $foo, 12, '$foo ok'  );
+
+# Test a string-compiled anonymous sub
+my $anon2 = eval <<'END_PERL';
+no warnings 'redefine';
+sub () {
+	$foo += 4;
+};
+END_PERL
+is( $@, '', 'Built new function without error' );
+is( $anon2->(), 16, 'foo() ok' );
+is( $foo, 16, '$foo ok'  );
+is( $anon2->(), 20, 'foo() ok' );
+is( $foo, 20, '$foo ok'  );
+
+# Replace with a string-compiled false-named anonymous sub
+# Test a string-compiled anonymous sub with no prototype
+eval <<'END_PERL';
+no warnings 'redefine';
+*foo = sub () {
+	$foo += 5;
+};
+END_PERL
+is( $@, '', 'Built new function without error' );
+is( foo(), 25, 'foo() ok' );
+is( $foo,  25, '$foo ok'  );
+is( foo(), 30, 'foo() ok' );
+is( $foo,  30, '$foo ok'  );

Added: branches/upstream/libaspect-perl/current/t/03_main.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/t/03_main.t?rev=49986&op=file
==============================================================================
--- branches/upstream/libaspect-perl/current/t/03_main.t (added)
+++ branches/upstream/libaspect-perl/current/t/03_main.t Sun Jan  3 01:14:00 2010
@@ -1,0 +1,72 @@
+#!/usr/bin/perl
+
+require 5.008;
+
+use strict;
+BEGIN {
+	$|  = 1;
+	$^W = 1;
+}
+use Carp;
+use FindBin;
+use lib ("$FindBin::Bin/../lib", "$FindBin::Bin/lib");
+use Test::Class;
+# use Test::NoWarnings;
+
+$ENV{TEST_VERBOSE} = 0;
+
+sub runtime_use {
+	my $package = shift;
+	eval "use $package;";
+	croak "Cannot use [$package]: $@" if $@;
+}
+
+my @classes;
+
+BEGIN {
+	my @ALL_TESTS = qw(
+ 		Aspect::Pointcut::tests::Call
+ 		Aspect::Pointcut::tests::Cflow
+ 		Aspect::tests::AdviceContext
+		Aspect::tests::Advice
+ 		Aspect::Library::tests::Singleton
+ 		Aspect::Library::tests::Wormhole
+		Aspect::Library::tests::Listenable
+	);
+
+	my $thing = 'Aspect::'. ($ARGV[0] || '');
+	$thing =~ s/(::)?([^:]+)?$/${
+		\( $1 || '')
+	}tests::${
+		\( $2 || '')
+	}/;
+
+	@classes = $thing eq 'Aspect::tests::' ? @ALL_TESTS : ($thing);
+
+	foreach my $class ( @classes ) {
+		runtime_use($class);
+	}
+}
+
+Test::Class->runtests(@classes);
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+run_tests.pl - run Aspect unit tests
+
+=head1 SYNOPSIS
+
+  # run all tests
+  perl run_tests.pl
+  
+  # a specific test case, no need to prefix with Aspect:: or add the tests:: part
+  perl run_tests.pl Weaver
+  perl run_tests.pl Pointcut::Call
+
+=cut

Added: branches/upstream/libaspect-perl/current/t/04_caller.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaspect-perl/current/t/04_caller.t?rev=49986&op=file
==============================================================================
--- branches/upstream/libaspect-perl/current/t/04_caller.t (added)
+++ branches/upstream/libaspect-perl/current/t/04_caller.t Sun Jan  3 01:14:00 2010
@@ -1,0 +1,46 @@
+#!/usr/bin/perl
+
+use strict;
+BEGIN {
+	$|  = 1;
+	$^W = 1;
+}
+use Test::More tests => 10;
+use Test::NoWarnings;
+use Aspect;
+
+my @CALLER = ();
+my $BEFORE = 0;
+
+SCOPE: {
+	package Foo;
+
+	sub foo {
+		Bar->bar;
+	}
+
+	package Bar;
+
+	sub bar {
+		@CALLER = (
+			[ caller(0) ],
+			[ caller(1) ],
+		);
+		return 'value';
+	}
+}
+
+# Set up the Aspect
+my $aspect = before { $BEFORE++ } call 'Bar::bar';
+isa_ok( $aspect, 'Aspect::Advice' );
+isa_ok( $aspect, 'Aspect::Advice::Before' );
+is( $BEFORE,         0, '$BEFORE is false' );
+is( scalar(@CALLER), 0, '@CALLER is empty' );
+
+# Call a method above the wrapped method
+my $rv = Foo->foo;
+is( $rv, 'value', '->foo is ok' );
+is( $BEFORE,         1, '$BEFORE is true' );
+is( scalar(@CALLER), 2, '@CALLER is full' );
+is( $CALLER[0]->[0], 'Foo',  'First caller is Foo'   );
+is( $CALLER[1]->[0], 'main', 'Second caller is main' );




More information about the Pkg-perl-cvs-commits mailing list