summaryrefslogtreecommitdiffstats
path: root/lib/Reply/Plugin/Packages.pm
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-06-26 13:52:02 -0400
committerJesse Luehrs <doy@tozt.net>2013-06-26 13:52:02 -0400
commit68371e78f12feffce4151d6fd9434c3ca46700bd (patch)
tree73c94f3e0ca365133be1b07974c067ae400bc4e3 /lib/Reply/Plugin/Packages.pm
parente3b56981b944b01084a51d5fc150ad596dd4a2fa (diff)
downloadreply-68371e78f12feffce4151d6fd9434c3ca46700bd.tar.gz
reply-68371e78f12feffce4151d6fd9434c3ca46700bd.zip
turn setting the current package into a parameter
Diffstat (limited to 'lib/Reply/Plugin/Packages.pm')
-rw-r--r--lib/Reply/Plugin/Packages.pm13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Reply/Plugin/Packages.pm b/lib/Reply/Plugin/Packages.pm
index eb69f96..d6fad68 100644
--- a/lib/Reply/Plugin/Packages.pm
+++ b/lib/Reply/Plugin/Packages.pm
@@ -36,7 +36,6 @@ sub mangle_line {
my $package = __PACKAGE__;
return <<LINE;
-package $self->{package};
$line
;
BEGIN {
@@ -47,16 +46,16 @@ LINE
sub compile {
my $self = shift;
- my ($next, @args) = @_;
+ my ($next, $line, %args) = @_;
+
+ $args{package} = $self->{package};
+
+ my @result = $next->($line, %args);
# XXX it'd be nice to avoid using globals here, but we can't use
# eval_closure's environment parameter since we need to access the
# information in a BEGIN block
- our $package = $self->{package};
-
- my @result = $next->(@args);
-
- $self->{package} = $package;
+ $self->{package} = our $package;
return @result;
}