this supposedly lets things like NYTProf report on time spent in evals
$args{source} = _line_directive(@args{qw(line description)})
. $args{source}
- if defined $args{description};
+ if defined $args{description} && !($^P & 0x10);
my ($code, $e) = _clean_eval_closure(@args{qw(source environment)});
--- /dev/null
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use Test::Fatal;
+
+BEGIN { $^P |= 0x210 } # PERLDBf_SUBLINE
+
+use Eval::Closure;
+
+unlike(
+ exception {
+ eval_closure(
+ source => 'sub { $bar }',
+ description => 'foo',
+ )
+ },
+ qr/#line/,
+ "#line directive isn't added when debugger is active"
+);
+
+
+done_testing;