From: Graham Knop Date: Fri, 13 Jun 2014 12:39:31 +0000 (-0400) Subject: increment line for each eval X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fline;p=p5sagit%2FEval-WithLexicals.git increment line for each eval --- diff --git a/lib/Eval/WithLexicals.pm b/lib/Eval/WithLexicals.pm index c30adb2..8faa583 100644 --- a/lib/Eval/WithLexicals.pm +++ b/lib/Eval/WithLexicals.pm @@ -30,6 +30,8 @@ has prelude => ( is => 'rw', default => quote_sub q{ 'use strictures 1;' } ); +has line => ( is => 'rw', default => 1 ); + sub with_plugins { my($class, @names) = @_; @@ -53,6 +55,8 @@ sub eval { local *Eval::WithLexicals::Cage::grab_captures; my $package = $self->in_package; + my $line = $self->line; + $self->line($line+1); my $setup_code = join '', $self->setup_code, # $_[2] being what is passed to _eval_do below Sub::Quote::capture_unroll('$_[2]', $self->lexicals, 2); @@ -63,7 +67,7 @@ sub eval { ${setup_code} sub Eval::WithLexicals::Cage::current_line { package ${package}; -#line 1 "(eval)" +#line $line "(eval)" ${to_eval} ;sub Eval::WithLexicals::Cage::pad_capture { } ${capture_code}