summaryrefslogtreecommitdiffstats
path: root/lib/Eval/Closure.pm
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-03-29 03:10:20 -0500
committerJesse Luehrs <doy@tozt.net>2012-03-29 03:10:20 -0500
commit21665b5f20fc7c96f4819bc1b754980e77849c05 (patch)
tree3c44892b2fb62bd58aa440b812f9a9862f0ddcc4 /lib/Eval/Closure.pm
parentfb4fd3f3c24529bc2a63b0e67822a19450ec8dc6 (diff)
downloadeval-closure-21665b5f20fc7c96f4819bc1b754980e77849c05.tar.gz
eval-closure-21665b5f20fc7c96f4819bc1b754980e77849c05.zip
get rid of the _< thing if it's not a real filename
Diffstat (limited to 'lib/Eval/Closure.pm')
-rw-r--r--lib/Eval/Closure.pm13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/Eval/Closure.pm b/lib/Eval/Closure.pm
index 161bcdf..46a3448 100644
--- a/lib/Eval/Closure.pm
+++ b/lib/Eval/Closure.pm
@@ -100,12 +100,23 @@ sub eval_closure {
$args{source} = _canonicalize_source($args{source});
_validate_env($args{environment} ||= {});
+ my $should_set_description = defined $args{description} && !($^P & 0x10);
+
$args{source} = _line_directive(@args{qw(line description)})
. $args{source}
- if defined $args{description} && !($^P & 0x10);
+ if $should_set_description;
+
+ my $existed_before;
+ $existed_before = exists $::{"_<$args{description}"}
+ if $should_set_description;
my ($code, $e) = _clean_eval_closure(@args{qw(source environment)});
+ if (!$existed_before && $should_set_description) {
+ # this will be meaningless, and just leaks memory
+ delete $::{"_<$args{description}"};
+ }
+
if (!$code) {
if ($args{terse_error}) {
die "$e\n";