From: Shawn M Moore Date: Fri, 22 May 2009 03:39:36 +0000 (-0400) Subject: Rename _make_wrapper to _curry_wrapper and fiddle its interface X-Git-Tag: 0.80~77 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6de00734f28025df349f1c46c1790fced79c28eb;p=gitmo%2FMoose.git Rename _make_wrapper to _curry_wrapper and fiddle its interface --- diff --git a/Changes b/Changes index 88d3321..e015997 100644 --- a/Changes +++ b/Changes @@ -9,6 +9,10 @@ for, noteworthy changes. - Win doy $10 dollars because Sartak didn't think anybody would document this fast enough (perigrin) + * Moose::Exporter + - Rename _make_wrapper to _curry_wrapper and fiddle its + interface a bit (Sartak) + 0.79 Wed, May 13, 2009 * Tests - More fixes for Win32 problems. Reported by Robert Krimen. diff --git a/lib/Moose/Exporter.pm b/lib/Moose/Exporter.pm index ff8a296..02c0646 100644 --- a/lib/Moose/Exporter.pm +++ b/lib/Moose/Exporter.pm @@ -187,7 +187,7 @@ sub _make_wrapped_sub { return sub { my $caller = $CALLER; - my $wrapper = $self->_make_wrapper($caller, $sub, $fq_name); + my $wrapper = $self->_curry_wrapper($sub, $fq_name, $caller); my $sub = subname($fq_name => $wrapper); @@ -197,16 +197,16 @@ sub _make_wrapped_sub { }; } -sub _make_wrapper { +sub _curry_wrapper { my $class = shift; - my $caller = shift; my $sub = shift; my $fq_name = shift; + my @extra = @_; - my $wrapper = sub { $sub->($caller, @_) }; + my $wrapper = sub { $sub->(@extra, @_) }; if (my $proto = prototype $sub) { # XXX - Perl's prototype sucks. Use & to make set_prototype - # ignore the fact that we're passing a "provate variable" + # ignore the fact that we're passing "private variables" &Scalar::Util::set_prototype($wrapper, $proto); } return $wrapper;