Skip Menu |

This queue is for tickets about the Data-DPath CPAN distribution.

Report information
The Basics
Id: 120716
Status: open
Priority: 0/
Queue: Data-DPath

People
Owner: Nobody in particular
Requestors: darren.foreman [...] zoopla.co.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Data::DPath filters fail in conjunction with the debugger or Devel::Cover
Date: Thu, 23 Mar 2017 13:29:36 +0000
To: bug-Data-DPath [...] rt.cpan.org
From: Darren Foreman <darren.foreman [...] zoopla.co.uk>
Problem summary: The filters from Data::DPath::Filters do not work when either the debugger or Devel::Cover are in use. Problem description: Simple Data::DPath expressions containing filters report different output - specifically, no matches - when using the default interactive Perl debugger or running code under Devel::Cover. Furthermore, the debugger throws warnings about the non-existence of subroutines in the Devel::DPath::Filters:: namespace. Steps to reproduce: Create a file with these contents: #!/usr/bin/perl use strict; use warnings; use Data::DPath qw(dpath); use Data::Dump qw(dump); my $path = '/*[size == 2]'; my $structure = { a => { b => 1, c => 2 } }; my @r = dpath($path)->match($structure); dump(\@r); Normal execution: $ perl dpath_bug.pl [{ b => 1, c => 2 }] With Devel::Cover: $ perl -MDevel::Cover=-silent,1 dpath_bug.pl 'require' trapped by operation mask at /usr/share/perl5/vendor_perl/Carp.pm line 3. Compilation failed in require at /usr/share/perl5/warnings.pm line 346. BEGIN failed--compilation aborted at (eval 84)[(eval 83)[/usr/local/share/perl5/Safe.pm:23]:1] line 1. [] With the debugger: $ perl -d dpath_bug.pl Loading DB routines from perl5db.pl version 1.37 Editor support available. Enter h or 'h h' for help, or 'man perldebug' for more help. main::(dpath_bug.pl:9): my $path = '/*[size == 2]'; DB<1> c Undefined subroutine &Data::DPath::Filters::size called at /usr/share/perl5/perl5db.pl line 3545. [] Debugged program terminated. Use q to quit or R to restart, use o inhibit_exit to avoid stopping after program termination, h q, h R or h o to get additional info. To be clear, it isn't limited just to the size filter; modify the above script like so: my $path = '/*/*[key eq "b"]'; And the problem remains: $ perl dpath_bug.pl [1] $ perl -MDevel::Cover=-silent,1 dpath_bug.pl 'require' trapped by operation mask at /usr/share/perl5/vendor_perl/Carp.pm line 3. Compilation failed in require at /usr/share/perl5/warnings.pm line 346. BEGIN failed--compilation aborted at (eval 84)[(eval 83)[/usr/local/share/perl5/Safe.pm:23]:1] line 1. Attempt to reload Carp.pm aborted. Compilation failed in require at /usr/share/perl5/warnings.pm line 346. BEGIN failed--compilation aborted at (eval 86)[(eval 85)[/usr/local/share/perl5/Safe.pm:23]:1] line 1. [] Distribution: $ perl -MData::DPath -e 'print Data::DPath->VERSION' 0.56 Also installed are Safe-2.35 and Devel::Cover 1.23. Version of Perl: This is perl 5, version 16, subversion 3 (v5.16.3) Operating system: Linux 3.10.57-57.140.amzn1.x86_64 #1 SMP Fri Oct 10 21:39:34 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
Hi Darren, in v0.57 we fixed something else related to the use of Safe.pm where it clashed with Test::Exception. It seems to me this also resolved your problem described here. At least your example worked for me. Can you please verify this? If it works now, feel free to close this ticket. If it does not work then I suggest to also try to not use Safe, eg with local $Data::DPath::USE_SAFE; in the code. Kind regards, Steffen On Thu Mar 23 09:30:13 2017, darren.foreman@zoopla.co.uk wrote: Show quoted text
> Problem summary: > > The filters from Data::DPath::Filters do not work when either the > debugger or Devel::Cover are in use. > > Problem description: > > Simple Data::DPath expressions containing filters report different > output - specifically, no matches - when using the default interactive > Perl debugger or running code under Devel::Cover. Furthermore, the > debugger throws warnings about the non-existence of subroutines in the > Devel::DPath::Filters:: namespace. > > Steps to reproduce: > > Create a file with these contents: > > #!/usr/bin/perl > > use strict; > use warnings; > > use Data::DPath qw(dpath); > use Data::Dump qw(dump); > > my $path = '/*[size == 2]'; > my $structure = { a => { b => 1, c => 2 } }; > > my @r = dpath($path)->match($structure); > > dump(\@r); > > Normal execution: > $ perl dpath_bug.pl > [{ b => 1, c => 2 }] > > With Devel::Cover: > $ perl -MDevel::Cover=-silent,1 dpath_bug.pl > 'require' trapped by operation mask at > /usr/share/perl5/vendor_perl/Carp.pm line 3. > Compilation failed in require at /usr/share/perl5/warnings.pm line > 346. > BEGIN failed--compilation aborted at (eval 84)[(eval > 83)[/usr/local/share/perl5/Safe.pm:23]:1] line 1. > > [] > > With the debugger: > $ perl -d dpath_bug.pl > > Loading DB routines from perl5db.pl version 1.37 > Editor support available. > > Enter h or 'h h' for help, or 'man perldebug' for more help. > > main::(dpath_bug.pl:9): my $path = '/*[size == 2]'; > DB<1> c > Undefined subroutine &Data::DPath::Filters::size called at > /usr/share/perl5/perl5db.pl line 3545. > > [] > Debugged program terminated. Use q to quit or R to restart, > use o inhibit_exit to avoid stopping after program termination, > h q, h R or h o to get additional info. > > To be clear, it isn't limited just to the size filter; modify the > above script like so: > > my $path = '/*/*[key eq "b"]'; > > And the problem remains: > > $ perl dpath_bug.pl > [1] > > $ perl -MDevel::Cover=-silent,1 dpath_bug.pl > 'require' trapped by operation mask at > /usr/share/perl5/vendor_perl/Carp.pm line 3. > Compilation failed in require at /usr/share/perl5/warnings.pm line > 346. > BEGIN failed--compilation aborted at (eval 84)[(eval > 83)[/usr/local/share/perl5/Safe.pm:23]:1] line 1. > > Attempt to reload Carp.pm aborted. > Compilation failed in require at /usr/share/perl5/warnings.pm line > 346. > BEGIN failed--compilation aborted at (eval 86)[(eval > 85)[/usr/local/share/perl5/Safe.pm:23]:1] line 1. > > [] > > Distribution: > $ perl -MData::DPath -e 'print Data::DPath->VERSION' > 0.56 > > Also installed are Safe-2.35 and Devel::Cover 1.23. > > Version of Perl: > This is perl 5, version 16, subversion 3 (v5.16.3) > > Operating system: > Linux 3.10.57-57.140.amzn1.x86_64 #1 SMP Fri Oct 10 21:39:34 UTC > 2014 x86_64 x86_64 x86_64 GNU/Linux
-- Steffen Schwigon <ss5@renormalist.net> Dresden Perl Mongers <http://dresden-pm.org/>