r49632 - in /trunk/libaspect-perl: ./ debian/ lib/ lib/Aspect/ lib/Aspect/Advice/ lib/Aspect/Library/ lib/Aspect/Pointcut/ t/ t/lib/Algorithm/ t/lib/Test/ t/lib/Text/ t/lib/_Aspect/tests/Advice/

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Thu Dec 31 20:24:31 UTC 2009


Author: gregoa
Date: Thu Dec 31 20:24:24 2009
New Revision: 49632

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=49632
Log:
* New upstream release 0.26

Added:
    trunk/libaspect-perl/t/05_wantarray.t
      - copied unchanged from r49631, branches/upstream/libaspect-perl/current/t/05_wantarray.t
Removed:
    trunk/libaspect-perl/lib/Aspect/Cleanup.pm
    trunk/libaspect-perl/lib/Aspect/Pointcut/BinOp.pm
    trunk/libaspect-perl/t/lib/Algorithm/
    trunk/libaspect-perl/t/lib/Test/
    trunk/libaspect-perl/t/lib/Text/
Modified:
    trunk/libaspect-perl/Changes
    trunk/libaspect-perl/MANIFEST
    trunk/libaspect-perl/META.yml
    trunk/libaspect-perl/Makefile.PL
    trunk/libaspect-perl/debian/changelog
    trunk/libaspect-perl/lib/Aspect.pm
    trunk/libaspect-perl/lib/Aspect/Advice.pm
    trunk/libaspect-perl/lib/Aspect/Advice/After.pm
    trunk/libaspect-perl/lib/Aspect/Advice/Before.pm
    trunk/libaspect-perl/lib/Aspect/AdviceContext.pm
    trunk/libaspect-perl/lib/Aspect/Library/Listenable.pm
    trunk/libaspect-perl/lib/Aspect/Library/Memoize.pm
    trunk/libaspect-perl/lib/Aspect/Library/Singleton.pm
    trunk/libaspect-perl/lib/Aspect/Library/TestClass.pm
    trunk/libaspect-perl/lib/Aspect/Library/Wormhole.pm
    trunk/libaspect-perl/lib/Aspect/Modular.pm
    trunk/libaspect-perl/lib/Aspect/Pointcut.pm
    trunk/libaspect-perl/lib/Aspect/Pointcut/AndOp.pm
    trunk/libaspect-perl/lib/Aspect/Pointcut/Call.pm
    trunk/libaspect-perl/lib/Aspect/Pointcut/Cflow.pm
    trunk/libaspect-perl/lib/Aspect/Pointcut/NotOp.pm
    trunk/libaspect-perl/lib/Aspect/Pointcut/OrOp.pm
    trunk/libaspect-perl/t/03_context.t
    trunk/libaspect-perl/t/lib/_Aspect/tests/Advice/Foo.pm

Modified: trunk/libaspect-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/Changes?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/Changes (original)
+++ trunk/libaspect-perl/Changes Thu Dec 31 20:24:24 2009
@@ -1,4 +1,47 @@
 Revision history for Perl extension Aspect
+
+0.26 Thu 31 Dec 2009 - Adam Kennedy
+	- With the primary internals refactoring completely, we now start
+	  a series of commits to remove excessive abstractions, and to alter
+	  others to more appropriate abstractions (still without changing
+	  any of the APIs)
+	- Cleaning up and refactoring the Aspect/Advice constructor code in
+	  Aspect.pm
+	- Removed the weird Aspect::Advice->new( type, code, pointcut ) for
+	  a more conventional ->new setup.
+	- Attempt to load Sub::Uplevel earlier (before we load Exporter) so
+	  there is an increased likelyhood that we don't have to reload
+	  Exporter later.
+	- Removed redundant references to Hook::LexWrap from the POD, and
+	  removed the "Convert to Sub::Uplevel" item from the TO DO list.
+	- Rewrote the Pointcut family of classes to have a simpler structure
+	  which should be faster. Some now use blessed ARRAYs as a
+	  preparatory step for allowing the AndOp/OrOp pointcuts to have
+	  more than just two elements (and to allow enable certain
+	  optimisation strategies down the line).
+	- Removed the faulty Aspect::Pointcut::BinOp abstraction entirely.
+	  It was causing boolean and/or operations to always run both sides,
+	  so unlike the overloaded expression they were created from, they
+	  would never shortcut. This is now resolved, and the an/or pointcut
+	  elements now shortcut properly.
+
+0.25 Thu 31 Dec 2009 - Adam Kennedy
+	- Debundled various out-of-date testing libraries, and reverted
+	  to more conventional build_requires dependencies now that our
+	  downstream packaging systems have the ability to consume them.
+	- Since the code documents the Aspect::Advice->install method as
+	  private (and it is undocumented) rename to ->_install as a
+	  precursor to changing it's behaviour at an API level.
+	- Now that the descope execution of the closure hook is able to be
+	  trusted, we no longer need the Aspect::Cleanup DESTROY-time
+	  self-execution magick.
+	- Added the ->wantarray property to the AdviceContext object.
+	  This is provided as a convenience to the user (since the wantarray)
+	  function works properly inside the advice code. It's main use is
+	  for some AspectContext internals.
+	- Added wantarray context test, which uncovered a bug where
+	  void-context calls were incorrectly running the advice in scalar
+	  context.
 
 0.24 Wed 30 Dec 2009 - Adam Kennedy
 	- Changes file now uses tabs (to make it less annoying for me) :)

Modified: trunk/libaspect-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/MANIFEST?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/MANIFEST (original)
+++ trunk/libaspect-perl/MANIFEST Thu Dec 31 20:24:24 2009
@@ -22,7 +22,6 @@
 lib/Aspect/Advice/After.pm
 lib/Aspect/Advice/Before.pm
 lib/Aspect/AdviceContext.pm
-lib/Aspect/Cleanup.pm
 lib/Aspect/Library/Listenable.pm
 lib/Aspect/Library/Memoize.pm
 lib/Aspect/Library/Singleton.pm
@@ -31,7 +30,6 @@
 lib/Aspect/Modular.pm
 lib/Aspect/Pointcut.pm
 lib/Aspect/Pointcut/AndOp.pm
-lib/Aspect/Pointcut/BinOp.pm
 lib/Aspect/Pointcut/Call.pm
 lib/Aspect/Pointcut/Cflow.pm
 lib/Aspect/Pointcut/NotOp.pm
@@ -44,16 +42,11 @@
 t/01_all.t
 t/02_caller.t
 t/03_context.t
+t/05_wantarray.t
 t/97_meta.t
 t/98_pod.t
 t/99_pmv.t
 t/lib/_Aspect/tests/Advice/Foo.pm
-t/lib/Algorithm/cdiff.pl
-t/lib/Algorithm/diff.pl
-t/lib/Algorithm/Diff.pm
-t/lib/Algorithm/diffnew.pl
-t/lib/Algorithm/DiffOld.pm
-t/lib/Algorithm/htmldiff.pl
 t/lib/Aspect/Library/tests/Listenable.pm
 t/lib/Aspect/Library/tests/Singleton.pm
 t/lib/Aspect/Library/tests/Wormhole.pm
@@ -61,15 +54,6 @@
 t/lib/Aspect/Pointcut/tests/Cflow.pm
 t/lib/Aspect/tests/Advice.pm
 t/lib/Aspect/tests/AdviceContext.pm
-t/lib/Test/Builder/Tester.pm
-t/lib/Test/Builder/Tester/Color.pm
-t/lib/Test/Class.pm
-t/lib/Test/Class.pod
-t/lib/Test/Class/MethodInfo.pm
-t/lib/Test/Differences.pm
-t/lib/Test/Exception.pm
-t/lib/Text/Diff.pm
-t/lib/Text/Diff/Table.pm
 xt/author/00_compile.t
 xt/author/01_perl_critic.t
 xt/author/02_pod.t

Modified: trunk/libaspect-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/META.yml?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/META.yml (original)
+++ trunk/libaspect-perl/META.yml Thu Dec 31 20:24:24 2009
@@ -1,10 +1,11 @@
 ---
 abstract: 'Aspect-oriented programming (AOP) for Perl'
 author:
-  - 'Marcel GrE<uuml>nauer <marcel at cpan.org>'
+  - 'Adam Kennedy <adamk at cpan.org>'
 build_requires:
   ExtUtils::MakeMaker: 6.42
-  Test::Class: 0.28
+  Test::Class: 0.33
+  Test::Exception: 0.27
   Test::More: 0.70
   Test::NoWarnings: 0.084
 configure_requires:
@@ -31,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.24
+version: 0.26

Modified: trunk/libaspect-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/Makefile.PL?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/Makefile.PL (original)
+++ trunk/libaspect-perl/Makefile.PL Thu Dec 31 20:24:24 2009
@@ -4,5 +4,6 @@
 requires      Devel::Symdump   2.04
 requires      Sub::Uplevel     0.2002
 test_requires Test::More       0.70
-test_requires Test::Class      0.28
+test_requires Test::Class      0.33
 test_requires Test::NoWarnings 0.084
+test_requires Test::Exception  0.27

Modified: trunk/libaspect-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/debian/changelog?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/debian/changelog (original)
+++ trunk/libaspect-perl/debian/changelog Thu Dec 31 20:24:24 2009
@@ -1,6 +1,10 @@
-libaspect-perl (0.24-1) unstable; urgency=low
+libaspect-perl (0.26-1) UNRELEASED; urgency=low
 
-  * New upstream release
+  [ Jonathan Yu ]
+  * New upstream release 0.24
+
+  [ gregor herrmann ]
+  * New upstream release 0.26
 
  -- Jonathan Yu <jawnsy at cpan.org>  Wed, 30 Dec 2009 23:24:45 -0500
 

Modified: trunk/libaspect-perl/lib/Aspect.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/lib/Aspect.pm?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/lib/Aspect.pm (original)
+++ trunk/libaspect-perl/lib/Aspect.pm Thu Dec 31 20:24:24 2009
@@ -3,30 +3,66 @@
 use 5.008002;
 use strict;
 use warnings;
-use Carp                    ();
+
+# Added by eilara as hack around caller() core dump
+# NOTE: Now we've switched to Sub::Uplevel can this be removed?
+# -- ADAMK
+use Carp::Heavy (); 
+use Carp        ();
+
+# NOTE: According to the Sub::UpLevel docs, we should load it before
+# we load Exporter. But that's a pretty difficult thing.
+# So we'll do the best we can here, and then in the future we might
+# want to consider switching to "use Sub::UpLevel ':aggressive';"
+# -- ADAMK
+use Sub::Uplevel            ();
 use Exporter                ();
 use Aspect::Advice          ();
 use Aspect::Pointcut::Call  ();
 use Aspect::Pointcut::Cflow ();
 
-our $VERSION = '0.24';
+our $VERSION = '0.26';
 our @ISA     = 'Exporter';
 our @EXPORT  = qw{ aspect before after call cflow };
 
 # Internal data storage
-my @ASPECT = undef;
-my @ADVICE = undef;
+my @FOREVER = ();
+
+
+
+
+
+######################################################################
+# Public (Exported) Functions
 
 sub aspect {
-	my ($name, @params) = @_;
-	$name = "Aspect::Library::$name";
-	runtime_use($name);
-	my $aspect = $name->new(@params);
+	my $name   = _LOAD('Aspect::Library::' . shift);
+	my $aspect = $name->new(@_);
 
 	# If called in void context, aspect is for life
-	push @ASPECT, $aspect unless defined wantarray;
+	push @FOREVER, $aspect unless defined wantarray;
 
 	return $aspect;
+}
+
+sub before (&$) {
+	require Aspect::Advice::Before;
+	my $advice = Aspect::Advice::Before->new(@_);
+
+	# If called in void context, advice is for life
+	push @FOREVER, $advice unless defined wantarray;
+
+	return $advice;
+}
+
+sub after (&$) {
+	require Aspect::Advice::After;
+	my $advice = Aspect::Advice::After->new(@_);
+
+	# If called in void context, advice is for life
+	push @FOREVER, $advice unless defined wantarray;
+
+	return $advice;
 }
 
 sub call ($) {
@@ -37,27 +73,21 @@
 	Aspect::Pointcut::Cflow->new(@_);
 }
 
-sub before (&$) {
-	advice( before => @_ );
-}
-
-sub after (&$) {
-	advice( after  => @_ );
-}
-
-sub advice {
-	my $advice = Aspect::Advice->new(@_);
-
-	# If called in void context, advice is for life
-	push @ADVICE, $advice unless defined wantarray;
-
-	return $advice;
-}
-
-sub runtime_use {
+
+
+
+
+######################################################################
+# Private Functions
+
+# Run-time use call
+# NOTE: Do we REALLY need to do this as a use?
+#       If the ->import method isn't important, change to native require.
+sub _LOAD {
 	my $package = shift;
 	eval "use $package;";
 	Carp::croak("Cannot use [$package]: $@") if $@;
+	return $package;
 }
 
 1;
@@ -377,15 +407,14 @@
 
 =head1 INTERNALS
 
-Due to the dynamic nature of Perl, and thanks to C<Hook::LexWrap>, there is no
-need for processing of source or byte code, as required in the Java and .NET
-worlds.
+Due to the dynamic nature of Perl, there is no need for processing of source
+or byte code, as required in the Java and .NET worlds.
 
 The implementation is very simple: when you create advice, its pointcut is
 matched using C<match_define()>. Every sub defined in the symbol table is
 matched against the pointcut. Those that match, will get a special wrapper
-installed, using C<Hook::LexWrap>. The wrapper only runs if during run-time,
-the C<match_run()> of the pointcut returns true.
+installed. The wrapper only runs if during run-time, the C<match_run()> of
+the pointcut returns true.
 
 The wrapper code creates an advice context, and gives it to the advice code.
 
@@ -483,10 +512,6 @@
 * look into byte code manipulation with B:: modules- could be faster, no
   need to mess with caller, and could add many more pointcut types. All
   we need to do for sub pointcuts is add 2 gotos to selected subs.
-
-* use Sub::Uplevel instead of Hook::LexWrap caller trick, thus we will
-  will play nice with other modules that use Sub::Uplevel (e.g. all the
-  test modules seem to use it)
 
 * a debug flag to print out subs that were matched on match_define
 
@@ -569,11 +594,11 @@
 
 =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>
-
-Adam Kennedy E<lt>adamk at cpan.orgE<gt>
 
 =head1 SEE ALSO
 
@@ -590,4 +615,3 @@
 it under the same terms as Perl itself.
 
 =cut
-

Modified: trunk/libaspect-perl/lib/Aspect/Advice.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/lib/Aspect/Advice.pm?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/lib/Aspect/Advice.pm (original)
+++ trunk/libaspect-perl/lib/Aspect/Advice.pm Thu Dec 31 20:24:24 2009
@@ -7,30 +7,21 @@
 use Aspect::Advice::After  ();
 use Aspect::Advice::Before ();
 
-our $VERSION = '0.24';
+our $VERSION = '0.26';
 
 sub new {
-	my $class = "Aspect::Advice::" . ucfirst($_[1]); # Yes, a bit hacky
-	my $self  = $class->new(
-		code     => $_[2], # The advice code
-		pointcut => $_[3], # The advice pointcut
-	);
+	my $self = bless {
+		code     => $_[1], # The advice code
+		pointcut => $_[2], # The advice pointcut
+	}, $_[0];
 
 	# Install and save the lexical hook
-	$self->{hook} = $self->install;
+	$self->{hook} = $self->_install;
 
 	return $self;
 }
 
 # private ---------------------------------------------------------------------
-
-sub install {
-	die("Method 'install' is not implemented by " . ref($_[0]));
-}
-
-sub type {
-	die("Method 'type' is not implemented by " . ref($_[0]));
-}
 
 sub code {
 	$_[0]->{code};
@@ -38,6 +29,11 @@
 
 sub pointcut {
 	$_[0]->{pointcut};
+}
+
+# Release the symbol table hooks via the closure controller
+sub DESTROY {
+	$_[0]->{hook}->() if $_[0]->{hook};
 }
 
 1;
@@ -106,9 +102,9 @@
 
 =head1 AUTHORS
 
-Marcel GrE<uuml>nauer, C<< <marcel at cpan.org> >>
+Marcel GrE<uuml>nauer E<lt>marcel at cpan.orgE<gt>
 
-Ran Eilam C<< <eilara at cpan.org> >>
+Ran Eilam E<lt>eilara at cpan.orgE<gt>
 
 =head1 COPYRIGHT AND LICENSE
 

Modified: trunk/libaspect-perl/lib/Aspect/Advice/After.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/lib/Aspect/Advice/After.pm?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/lib/Aspect/Advice/After.pm (original)
+++ trunk/libaspect-perl/lib/Aspect/Advice/After.pm Thu Dec 31 20:24:24 2009
@@ -5,27 +5,15 @@
 
 # Added by eilara as hack around caller() core dump
 # NOTE: Now we've switched to Sub::Uplevel can this be removed? --ADAMK
-use Carp::Heavy     (); 
-use Carp            ();
-use Sub::Uplevel    ();
-use Aspect::Cleanup ();
-use Aspect::Advice  ();
+use Carp::Heavy    (); 
+use Carp           ();
+use Sub::Uplevel   ();
+use Aspect::Advice ();
 
-our $VERSION = '0.24';
+our $VERSION = '0.26';
 our @ISA     = 'Aspect::Advice';
 
-sub new {
-	my $class = shift;
-	return bless { @_ }, $class;
-}
-
-# This should never be called by our own code.
-# It only exists for back-compatibility purposes.
-sub type {
-	return 'after';
-}
-
-sub install {
+sub _install {
 	my $self     = shift;
 	my $pointcut = $self->pointcut;
 	my $code     = $self->code;
@@ -78,7 +66,7 @@
 					type         => 'after',
 					pointcut     => $pointcut,
 					sub_name     => $name,
-					# wantarray    => $wantarray,
+					wantarray    => $wantarray,
 					params       => \@_,
 					return_value => $return,
 					original     => $original,
@@ -109,7 +97,7 @@
 					type         => 'after',
 					pointcut     => $pointcut,
 					sub_name     => $name,
-					# wantarray    => $wantarray,
+					wantarray    => $wantarray,
 					params       => \@_,
 					return_value => $return,
 					original     => $original,
@@ -132,22 +120,25 @@
 					type         => 'after',
 					pointcut     => $pointcut,
 					sub_name     => $name,
-					# wantarray    => $wantarray,
+					wantarray    => $wantarray,
 					params       => \@_,
 					return_value => undef,
 					original     => $original,
 				);
 
 				# Execute the advice code
-				my $dummy = &$code($context);
+				&$code($context);
 				return;
 			}
 		}};
 		die $@ if $@;
 	}
 
-	# Return the lexical hook
-	return Aspect::Cleanup->new( sub { $out_of_scope = 1 } );
+	# Return the lexical descoping hook.
+	# This MUST be stored and run at DESTROY-time by the
+	# parent object calling _install. This is less bullet-proof
+	# than the DESTROY-time self-executing blessed coderef
+	return sub { $out_of_scope = 1 };
 }
 
 1;

Modified: trunk/libaspect-perl/lib/Aspect/Advice/Before.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/lib/Aspect/Advice/Before.pm?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/lib/Aspect/Advice/Before.pm (original)
+++ trunk/libaspect-perl/lib/Aspect/Advice/Before.pm Thu Dec 31 20:24:24 2009
@@ -7,24 +7,12 @@
 # NOTE: Now we've switched to Sub::Uplevel can this be removed? --ADAMK
 use Carp::Heavy     (); 
 use Carp            ();
-use Aspect::Cleanup ();
 use Aspect::Advice  ();
 
-our $VERSION = '0.24';
+our $VERSION = '0.26';
 our @ISA     = 'Aspect::Advice';
 
-sub new {
-	my $class = shift;
-	return bless { @_ }, $class;
-}
-
-# This should never be called by our own code.
-# It only exists for back-compatibility purposes.
-sub type {
-	return 'before';
-}
-
-sub install {
+sub _install {
 	my $self     = shift;
 	my $pointcut = $self->pointcut;
 	my $code     = $self->code;
@@ -72,7 +60,7 @@
 				type         => 'before',
 				pointcut     => $pointcut,
 				sub_name     => $name,
-				# wantarray    => $wantarray,
+				wantarray    => $wantarray,
 				params       => \@_,
 				return_value => $wantarray ? [ ] : undef,
 				original     => $original,
@@ -118,8 +106,11 @@
 		die $@ if $@;
 	}
 
-	# Return the lexical hook
-	return Aspect::Cleanup->new( sub { $out_of_scope = 1 } );
+	# Return the lexical descoping hook.
+	# This MUST be stored and run at DESTROY-time by the
+	# parent object calling _install. This is less bullet-proof
+	# than the DESTROY-time self-executing blessed coderef
+	return sub { $out_of_scope = 1 };
 }
 
 1;

Modified: trunk/libaspect-perl/lib/Aspect/AdviceContext.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/lib/Aspect/AdviceContext.pm?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/lib/Aspect/AdviceContext.pm (original)
+++ trunk/libaspect-perl/lib/Aspect/AdviceContext.pm Thu Dec 31 20:24:24 2009
@@ -4,7 +4,7 @@
 use warnings;
 use Carp ();
 
-our $VERSION = '0.24';
+our $VERSION = '0.26';
 
 sub new {
 	my $class = shift;
@@ -91,8 +91,7 @@
 
 sub AUTOLOAD {
 	my $self = shift;
-	my $key = our $AUTOLOAD;
-	return if $key =~ /DESTROY$/;
+	my $key  = our $AUTOLOAD;
 	$key =~ s/^.*:://;
 	return $self->get_value($key);
 }
@@ -103,6 +102,10 @@
 	my $value = $self->{$key};
 	return wantarray && ref $value eq 'ARRAY'? @$value: $value;
 }
+
+# Improves performance by not having to send DESTROY calls
+# through AUTOLOAD, and not having to check for DESTROY in AUTOLOAD.
+sub DESTROY () { }
 
 1;
 

Modified: trunk/libaspect-perl/lib/Aspect/Library/Listenable.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/lib/Aspect/Library/Listenable.pm?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/lib/Aspect/Library/Listenable.pm (original)
+++ trunk/libaspect-perl/lib/Aspect/Library/Listenable.pm Thu Dec 31 20:24:24 2009
@@ -11,7 +11,7 @@
 use Aspect;
 use Aspect::Modular ();
 
-our $VERSION = '0.24';
+our $VERSION = '0.26';
 our @ISA     = qw{Aspect::Modular Exporter};
 our @EXPORT  = qw{add_listener remove_listener};
 

Modified: trunk/libaspect-perl/lib/Aspect/Library/Memoize.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/lib/Aspect/Library/Memoize.pm?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/lib/Aspect/Library/Memoize.pm (original)
+++ trunk/libaspect-perl/lib/Aspect/Library/Memoize.pm Thu Dec 31 20:24:24 2009
@@ -7,7 +7,7 @@
 use Aspect;
 use Aspect::Modular ();
 
-our $VERSION = '0.24';
+our $VERSION = '0.26';
 our @ISA     = 'Aspect::Modular';
 
 sub get_advice {

Modified: trunk/libaspect-perl/lib/Aspect/Library/Singleton.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/lib/Aspect/Library/Singleton.pm?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/lib/Aspect/Library/Singleton.pm (original)
+++ trunk/libaspect-perl/lib/Aspect/Library/Singleton.pm Thu Dec 31 20:24:24 2009
@@ -6,7 +6,7 @@
 use Aspect;
 use Aspect::Modular ();
 
-our $VERSION = '0.24';
+our $VERSION = '0.26';
 our @ISA     = 'Aspect::Modular';
 
 my %Cache;

Modified: trunk/libaspect-perl/lib/Aspect/Library/TestClass.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/lib/Aspect/Library/TestClass.pm?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/lib/Aspect/Library/TestClass.pm (original)
+++ trunk/libaspect-perl/lib/Aspect/Library/TestClass.pm Thu Dec 31 20:24:24 2009
@@ -7,7 +7,7 @@
 use Aspect;
 use Aspect::Modular ();
 
-our $VERSION = '0.24';
+our $VERSION = '0.26';
 our @ISA     = 'Aspect::Modular';
 
 sub Test::Class::make_subject {

Modified: trunk/libaspect-perl/lib/Aspect/Library/Wormhole.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/lib/Aspect/Library/Wormhole.pm?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/lib/Aspect/Library/Wormhole.pm (original)
+++ trunk/libaspect-perl/lib/Aspect/Library/Wormhole.pm Thu Dec 31 20:24:24 2009
@@ -6,7 +6,7 @@
 use Aspect;
 use Aspect::Modular ();
 
-our $VERSION = '0.24';
+our $VERSION = '0.26';
 our @ISA     = 'Aspect::Modular';
 
 sub get_advice {

Modified: trunk/libaspect-perl/lib/Aspect/Modular.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/lib/Aspect/Modular.pm?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/lib/Aspect/Modular.pm (original)
+++ trunk/libaspect-perl/lib/Aspect/Modular.pm Thu Dec 31 20:24:24 2009
@@ -5,7 +5,7 @@
 use Carp;
 
 
-our $VERSION = '0.24';
+our $VERSION = '0.26';
 
 
 # creating --------------------------------------------------------------------

Modified: trunk/libaspect-perl/lib/Aspect/Pointcut.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/lib/Aspect/Pointcut.pm?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/lib/Aspect/Pointcut.pm (original)
+++ trunk/libaspect-perl/lib/Aspect/Pointcut.pm Thu Dec 31 20:24:24 2009
@@ -3,26 +3,25 @@
 use strict;
 use warnings;
 use Carp;
-use Data::Dumper   ();
-use Devel::Symdump ();
-use Aspect::Pointcut::AndOp;
-use Aspect::Pointcut::OrOp;
-use Aspect::Pointcut::NotOp;
+use Data::Dumper            ();
+use Devel::Symdump          ();
+use Aspect::Pointcut::OrOp  ();
+use Aspect::Pointcut::AndOp ();
+use Aspect::Pointcut::NotOp ();
 
-our $VERSION = '0.24';
+our $VERSION = '0.26';
 
+use overload (
+	'|'  => sub { Aspect::Pointcut::OrOp->new(@_)  },
+	'&'  => sub { Aspect::Pointcut::AndOp->new(@_) },
+	'!'  => sub { Aspect::Pointcut::NotOp->new(@_) },
+	'""' => sub { Data::Dumper::Dumper shift       },
+);
 
-use overload
-	'&'  => sub { Aspect::Pointcut::AndOp->new(@_) },
-	'|'  => sub { Aspect::Pointcut::OrOp ->new(@_) },
-	'!'  => sub { Aspect::Pointcut::NotOp->new(@_) },
-	'""' => sub { Data::Dumper::Dumper shift };
-
+# Default constructor takes a simple list of params
 sub new {
-	my ($class, @spec) = @_;
-	my $self = bless {}, $class;
-	$self->init(@spec);
-	return $self;
+	my $class = shift;
+	bless [ @_ ], $class;
 }
 
 # TODO: if it is 'eq' we can jusy grab it
@@ -33,8 +32,6 @@
 		ref $spec eq 'CODE'  ? $spec->($sub_name):
 		$spec eq $sub_name;
 }
-
-sub init {}
 
 # weaving methods -------------------------------------------------------------
 
@@ -67,6 +64,7 @@
 # template methods ------------------------------------------------------------
 
 sub match_define { 1 }
+
 sub match_run    { 1 }
 
 1;

Modified: trunk/libaspect-perl/lib/Aspect/Pointcut/AndOp.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/lib/Aspect/Pointcut/AndOp.pm?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/lib/Aspect/Pointcut/AndOp.pm (original)
+++ trunk/libaspect-perl/lib/Aspect/Pointcut/AndOp.pm Thu Dec 31 20:24:24 2009
@@ -2,13 +2,29 @@
 
 use strict;
 use warnings;
-use Carp;
-use Aspect::Pointcut::BinOp ();
+use Aspect::Pointcut ();
 
-our $VERSION = '0.24';
-our @ISA     = 'Aspect::Pointcut::BinOp';
+our $VERSION = '0.26';
+our @ISA     = 'Aspect::Pointcut';
 
-sub binop { $_[1] && $_[2] }
+sub new {
+	my $class = shift;
+	bless [ @_ ], $class;
+}
+
+sub match_define {
+	my $self = shift;
+	$self->[0]->match_define(@_)
+	&&
+	$self->[1]->match_define(@_)
+}
+
+sub match_run {
+	my $self = shift;
+	$self->[0]->match_run(@_)
+	&&
+	$self->[1]->match_run(@_);
+}
 
 1;
 

Modified: trunk/libaspect-perl/lib/Aspect/Pointcut/Call.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/lib/Aspect/Pointcut/Call.pm?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/lib/Aspect/Pointcut/Call.pm (original)
+++ trunk/libaspect-perl/lib/Aspect/Pointcut/Call.pm Thu Dec 31 20:24:24 2009
@@ -5,16 +5,16 @@
 use Carp;
 use Aspect::Pointcut ();
 
-our $VERSION = '0.24';
+our $VERSION = '0.26';
 our @ISA     = 'Aspect::Pointcut';
 
-sub init {
-	shift->{spec} = pop;
+sub new {
+	bless [ $_[1] ], $_[0];
 }
 
 sub match_define {
-	my ($self, $sub_name) = @_;
-	return $self->match($self->{spec}, $sub_name);
+	my $self = shift;
+	return $self->match( $self->[0], @_ );
 }
 
 1;

Modified: trunk/libaspect-perl/lib/Aspect/Pointcut/Cflow.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/lib/Aspect/Pointcut/Cflow.pm?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/lib/Aspect/Pointcut/Cflow.pm (original)
+++ trunk/libaspect-perl/lib/Aspect/Pointcut/Cflow.pm Thu Dec 31 20:24:24 2009
@@ -2,18 +2,23 @@
 
 use strict;
 use warnings;
-use Carp;
-use Aspect::AdviceContext;
-use Aspect::Pointcut ();
+use Carp                  ();
+use Aspect::Pointcut      ();
+use Aspect::AdviceContext ();
 
-our $VERSION = '0.24';
+our $VERSION = '0.26';
 our @ISA     = 'Aspect::Pointcut';
 
-sub init {
-	my $self = shift;
-	carp 'Cflow must be created with 2 parameters' unless @_ == 2;
-	$self->{runtime_context_key} = shift;
-	$self->{spec} = shift;
+sub new {
+	my $class = shift;
+	unless ( @_ == 2 ) {
+		Carp::carp 'Cflow must be created with 2 parameters';
+	}
+
+	return bless {
+		runtime_context_key => $_[0],
+		spec                => $_[1],
+	}, $class;
 }
 
 sub match_run {
@@ -34,7 +39,7 @@
 	my $self  = shift;
 	my $level = 2;
 	my $caller_info;
-	while (1) {
+	while ( 1 ) {
 		$caller_info = $self->caller_info($level++);
 		last if
 			!$caller_info ||
@@ -53,9 +58,7 @@
 		{ %call_info, params => [$call_info{has_params}? @DB::args: ()] }: 0;
 }
 
-
 1;
-
 
 __END__
 

Modified: trunk/libaspect-perl/lib/Aspect/Pointcut/NotOp.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/lib/Aspect/Pointcut/NotOp.pm?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/lib/Aspect/Pointcut/NotOp.pm (original)
+++ trunk/libaspect-perl/lib/Aspect/Pointcut/NotOp.pm Thu Dec 31 20:24:24 2009
@@ -2,27 +2,24 @@
 
 use strict;
 use warnings;
-use Carp;
 use Aspect::Pointcut ();
 
-our $VERSION = '0.24';
+our $VERSION = '0.26';
 our @ISA     = 'Aspect::Pointcut';
 
-sub init { shift->{op} = pop }
+sub new {
+	bless [ $_[1] ], $_[0];
+}
 
 sub match_define {
-	my ($self, $sub_name) = @_;
-	return !$self->{op}->match_define($sub_name);
+	return ! shift->[0]->match_define(@_);
 }
 
 sub match_run {
-	my ($self, $sub_name) = @_;
-	return !$self->{op}->match_run($sub_name);
+	return ! shift->[0]->match_run(@_);
 }
 
-
 1;
-
 
 __END__
 

Modified: trunk/libaspect-perl/lib/Aspect/Pointcut/OrOp.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/lib/Aspect/Pointcut/OrOp.pm?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/lib/Aspect/Pointcut/OrOp.pm (original)
+++ trunk/libaspect-perl/lib/Aspect/Pointcut/OrOp.pm Thu Dec 31 20:24:24 2009
@@ -2,13 +2,29 @@
 
 use strict;
 use warnings;
-use Carp;
-use Aspect::Pointcut::BinOp ();
+use Aspect::Pointcut ();
 
-our $VERSION = '0.24';
-our @ISA     = 'Aspect::Pointcut::BinOp';
+our $VERSION = '0.26';
+our @ISA     = 'Aspect::Pointcut';
 
-sub binop { $_[1] || $_[2] }
+sub new {
+	my $class = shift;
+	bless [ @_ ], $class;
+}
+
+sub match_define {
+	my $self = shift;
+	$self->[0]->match_define(@_)
+	||
+	$self->[1]->match_define(@_)
+}
+
+sub match_run {
+	my $self = shift;
+	$self->[0]->match_run(@_)
+	||
+	$self->[1]->match_run(@_);
+}
 
 1;
 

Modified: trunk/libaspect-perl/t/03_context.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/t/03_context.t?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/t/03_context.t (original)
+++ trunk/libaspect-perl/t/03_context.t Thu Dec 31 20:24:24 2009
@@ -1,6 +1,7 @@
 #!/usr/bin/perl
 
-# Validates some assumptions by the author about how context and return work
+# Validates some assumptions built into the Aspect code about how context
+# and return work.
 
 use strict;
 BEGIN {

Modified: trunk/libaspect-perl/t/lib/_Aspect/tests/Advice/Foo.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libaspect-perl/t/lib/_Aspect/tests/Advice/Foo.pm?rev=49632&op=diff
==============================================================================
--- trunk/libaspect-perl/t/lib/_Aspect/tests/Advice/Foo.pm (original)
+++ trunk/libaspect-perl/t/lib/_Aspect/tests/Advice/Foo.pm Thu Dec 31 20:24:24 2009
@@ -10,6 +10,7 @@
 sub inc { $_[1] + 1       }
 
 sub main::advice_tests_func_no_proto       { shift }
+
 sub main::advice_tests_func_with_proto ($) { shift }
 
 1;




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