App-PerlShell
view release on metacpan or search on metacpan
lib/App/PerlShell/LexPersist.pm view on Meta::CPAN
for ( keys(%cfg) ) {
if (/^-?package$/i) {
$package = $cfg{$_};
delete $cfg{$_};
} else {
$params{$_} = $cfg{$_};
}
}
}
my $self = $class->SUPER::new(@_);
$self->{package} = $package;
# following line avoids ugly error if first command in shell is
# $var = ... without the "my"
$PACKAGE = $package;
return $self;
}
sub get_package {
lib/App/PerlShell/LexPersist.pm view on Meta::CPAN
package $package;
$code
BEGIN {
\$App::PerlShell::LexPersist::PACKAGE = __PACKAGE__;
}
END_PERL
# Hand off to the parent version
return $self->SUPER::prepare( $code, @_ );
}
# Modifications to the package are tracked at compile-time
sub compile {
my $self = shift;
my $sub = $self->SUPER::compile(@_);
# Save the package state
$self->set_package($PACKAGE);
return $sub;
}
1;
__END__
( run in 0.249 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )