diff options
Diffstat (limited to 'lib/App/REPL/Plugin/Hints.pm')
-rw-r--r-- | lib/App/REPL/Plugin/Hints.pm | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/App/REPL/Plugin/Hints.pm b/lib/App/REPL/Plugin/Hints.pm index 9d198e2..a09f117 100644 --- a/lib/App/REPL/Plugin/Hints.pm +++ b/lib/App/REPL/Plugin/Hints.pm @@ -25,7 +25,14 @@ sub new { return $self; } -sub evaluate { +sub mangle_line { + my $self = shift; + my ($line) = @_; + + return "BEGIN { \$^H = \$" . __PACKAGE__ . "::hints; \%^H = \%\$" . __PACKAGE__ . "::hinthash; \${^WARNING_BITS} = \$" . __PACKAGE__ . "::warning_bits } $line; BEGIN { \$" . __PACKAGE__ . "::hints = \$^H; \$" . __PACKAGE__ . "::hinthash = \\\%^H; \$" . __PACKAGE__ . "::warning_bits = \${^WARNING_BITS} }"; +} + +sub compile { my $self = shift; my ($next, $line, %args) = @_; @@ -36,8 +43,6 @@ sub evaluate { our $hinthash = $self->{hinthash}; our $warning_bits = $self->{warning_bits}; - $line = "BEGIN { \$^H = \$" . __PACKAGE__ . "::hints; \%^H = \%\$" . __PACKAGE__ . "::hinthash; \${^WARNING_BITS} = \$" . __PACKAGE__ . "::warning_bits } $line; BEGIN { \$" . __PACKAGE__ . "::hints = \$^H; \$" . __PACKAGE__ . "::hinthash = \\\%^H; \$" . __PACKAGE__ . "::warning_bits = \${^WARNING_BITS} }"; - my @result = $next->($line, %args); $self->{hints} = $hints; |