From 41c192d5c23cc484c0f57570a614b3d635a60c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Fri, 7 Aug 2015 10:09:25 +0200 Subject: [PATCH] Use Data::Dumper instead of Data::Dump::Streamer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Data::Dump::Streamer does not work with perl-5.22.0. It's used only for formating output. Let use Data::Dumper now. CPAN RT#105016 Signed-off-by: Petr Písař --- Makefile.PL | 2 +- lib/Devel/REPL/Plugin/Carp/REPL.pm | 12 ++++++++++-- t/12-env.t | 28 ++++++++++++++-------------- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index e7ea4ef..8d3dbe7 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -58,7 +58,7 @@ my %WriteMakefileArgs = ( 'Devel::LexAlias' => '0', 'Devel::REPL' => '0', 'namespace::autoclean' => '0', - 'Data::Dump::Streamer' => '0', + 'Data::Dumper' => '0', 'Lexical::Persistence' => '0', }, }, diff --git a/lib/Devel/REPL/Plugin/Carp/REPL.pm b/lib/Devel/REPL/Plugin/Carp/REPL.pm index 5c55a83..71f8ec4 100644 --- a/lib/Devel/REPL/Plugin/Carp/REPL.pm +++ b/lib/Devel/REPL/Plugin/Carp/REPL.pm @@ -6,7 +6,7 @@ use Devel::REPL::Plugin; use namespace::autoclean; use Devel::LexAlias; use Devel::StackTrace::WithLexicals; -use Data::Dump::Streamer; +use Data::Dumper; sub BEFORE_PLUGIN { my $self = shift; @@ -140,7 +140,15 @@ around 'read' => sub { } if ($line =~ /^\s*:e(?:nv)?\s*/) { - $self->print(Dump($self->frame->lexicals)->Names('Env')->Out); + my $formater = Data::Dumper->new([$self->frame->lexicals]); + $formater->Useqq(1); + $formater->Varname('Env'); + $formater->Quotekeys(0); + $formater->Sortkeys(1); + $formater->Deparse(1); + my $output = $formater->Dump; + $output =~ s/^\$Env1 =/\$Env =/; + $self->print($output); return ''; } diff --git a/t/12-env.t b/t/12-env.t index 1eab05c..526f917 100644 --- a/t/12-env.t +++ b/t/12-env.t @@ -22,24 +22,24 @@ expect_like(qr{\bNow at t/scripts/12-env\.pl:42 \(frame 1\)\.}); expect_send(':e'); expect_like(qr/\$Env = \{(?!\};)/); -expect_like(qr/"\\\$alpha" => \\do \{ my \$v = 1 \}/); -expect_like(qr/"%args" => \{/); +expect_like(qr/"\\\$alpha" => \\1/); +expect_like(qr/"%args" +=> \{/); expect_like(qr/Be => 4/); -expect_like(qr/H => 1/); +expect_like(qr/H +=> 1/); expect_like(qr/He => 2/); expect_like(qr/Li => 3/); -expect_like(qr/"\\\$beta" => \\do \{ my \$v = 2 \}/); -expect_like(qr/"\\\$delta" => \\do \{ my \$v = 4 \}/); -expect_like(qr/"\\\$gamma" => \\do \{ my \$v = 3 \}/); +expect_like(qr/"\\\$beta" +=> \\2/); +expect_like(qr/"\\\$delta" => \\4/); +expect_like(qr/"\\\$gamma" => \\3/); expect_send(':u'); expect_like(qr{\bNow at t/scripts/12-env\.pl:44 \(frame 2\)\.}); expect_send(':e'); expect_like(qr/\$Env = \{(?!\};)/); -expect_like(qr/"%args" => \{/); +expect_like(qr/"%args" +=> \{/); expect_like(qr/Be => 4/); -expect_like(qr/H => 1/); +expect_like(qr/H +=> 1/); expect_like(qr/He => 2/); expect_like(qr/Li => 3/); expect_like(qr/\+.*\+.*\+/); @@ -49,23 +49,23 @@ expect_like(qr{\bNow at t/scripts/12-env\.pl:28 \(frame 3\)\.}); expect_send(':e'); expect_like(qr/\$Env = \{(?!\};)/); -expect_like(qr/"\\\$dos" => \\do \{ my \$v = 'is' \}/); -expect_like(qr/"\\\$tres" => \\do \{ my \$v = 'I' \}/); -expect_like(qr/"\\\$uno" => \\do \{ my \$v = 'I' \}/); +expect_like(qr/"\\\$dos" +=> \\"is"/); +expect_like(qr/"\\\$tres" => \\"I"/); +expect_like(qr/"\\\$uno" +=> \\"I"/); expect_send(':u'); expect_like(qr{\bNow at t/scripts/12-env\.pl:19 \(frame 4\)\.}); expect_send(':e'); expect_like(qr/\$Env = \{(?!\};)/); -expect_like(qr/"\\\$a" => \\do \{ my \$v = 'I' \}/); -expect_like(qr/"\\\$b" => \\do \{ my \$v = 'I' \}/); +expect_like(qr/"\\\$a" => \\"I"/); +expect_like(qr/"\\\$b" => \\"I"/); expect_send(':u'); expect_like(qr{\b\QNow at t/scripts/12-env.pl:13 (frame 5).\E}); expect_send(':e'); -expect_like(qr/\$Env = \{ "\\\$num" => \\do \{ my \$v = 'I' \} \};/); +expect_like(qr/\$Env = \{\n +"\\\$num" => \\"I"\n +\};/); expect_send(':u'); expect_like(qr{\b\QNow at t/scripts/12-env.pl:7 (frame 6).\E}); -- 2.4.3