From 436bede5fac60885a053baadf5dd659b258997b0 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 27 Jun 2013 17:41:33 -0400 Subject: make the current package go through the publisher too --- lib/Reply/Plugin/Packages.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/Reply/Plugin/Packages.pm') diff --git a/lib/Reply/Plugin/Packages.pm b/lib/Reply/Plugin/Packages.pm index d6fad68..054467a 100644 --- a/lib/Reply/Plugin/Packages.pm +++ b/lib/Reply/Plugin/Packages.pm @@ -26,6 +26,9 @@ sub new { my $self = $class->SUPER::new(@_); $self->{package} = $opts{default_package} || 'main'; + $self->{publisher} = $opts{publisher}; + + $self->{publisher}->(package => $self->{package}); return $self; } @@ -48,14 +51,13 @@ sub compile { my $self = shift; 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 $self->{package} = our $package; + $self->{publisher}->(package => $self->{package}); return @result; } -- cgit v1.2.3-54-g00ecf