Skip Menu |
 

This queue is for tickets about the List-MoreUtils CPAN distribution.

Report information
The Basics
Id: 62162
Status: rejected
Priority: 0/
Queue: List-MoreUtils

People
Owner: Nobody in particular
Requestors: DAMI [...] cpan.org
Cc:
AdminCc:

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



Subject: mess up the @_ array under Perl debugger.
Download (untitled) / with headers
text/plain 571b
When running under the Perl debugger, 'all' or 'any' mess up the @_ array : they seem to introduce a coderef within the array. See the attached mini-program. Execution results are as follows : Normal execution D:/strawberry/perl/bin\perl.exe -w -I../lib d:/SVN/DMWeb- 3.3/DMWeb/lib/DMWeb/Controller/foo.pl REGEX IS : (?-xism:^..$) and the result is : 1 Debugger : DB<1> c REGEX IS : CODE(0xd32f5c) REGEX IS : CODE(0xd32f5c) REGEX IS : CODE(0xd32f5c) [..crash..] I'm running Strawberry perl 5, version 12, subversion 1 (v5.12.1) built for MSWin32-x86-multi-thread
Subject: bug_more_utils.pl
Download bug_more_utils.pl
text/x-perl 359b
use strict; use warnings; use List::MoreUtils qw/all any/; my $data = [qw/ab cd ef/]; sub match_all { my $dataref = shift; return any {match($_, @_)} @$dataref; } sub match { my ($data, $regex) = @_; print STDERR "REGEX IS : $regex\n"; return $data =~ $regex; } my $r = match_all($data, qr/^..$/); print "and the result is : ", $r, "\n";
Download (untitled) / with headers
text/plain 776b
On 2010-10-15 06:27:10, DAMI wrote: Show quoted text
> When running under the Perl debugger, 'all' or 'any' mess up the @_ > array : they seem to introduce a coderef within the array. See the > attached mini-program. Execution results are as follows : > > Normal execution > D:/strawberry/perl/bin\perl.exe -w -I../lib d:/SVN/DMWeb- > 3.3/DMWeb/lib/DMWeb/Controller/foo.pl > REGEX IS : (?-xism:^..$) > and the result is : 1 > > Debugger : > DB<1> c > REGEX IS : CODE(0xd32f5c) > REGEX IS : CODE(0xd32f5c) > REGEX IS : CODE(0xd32f5c) > [..crash..] > > I'm running Strawberry perl 5, version 12, subversion 1 (v5.12.1) built > for MSWin32-x86-multi-thread
Another @_-related problem (without debugger, just using the PP variant) is described in https://sourceforge.net/p/pdl/bugs/432/
Download (untitled) / with headers
text/plain 513b
When I understand following line correctly: Show quoted text
> return any {match($_, @_)} @$dataref;
^ ^ | +-> the remaining arguments from match_all($data, qr/^..$/); +-> the current loop element of all/any/none/... Ever wondered why "map { map { $_ => $_ } @{$_} } ( [ 1..4 ], [ 5..6 ], [ 7..10 ] )" does have 2 identical values in the inner map? @_ is always the list of arguments when entering a SUB (not an XSUB). That works as designed, your code is wrong.
Subject: Re: [rt.cpan.org #62162] mess up the @_ array under Perl debugger.
Date: Sun, 30 Apr 2017 21:00:41 +0200
To: bug-List-MoreUtils [...] rt.cpan.org
From: Laurent Dami <laurent.dami [...] free.fr>
Download (untitled) / with headers
text/plain 671b
Hi Jens, Maybe my bug description wasn't clear enough, but I think there is some misunderstanding here. Show quoted text
> Ever wondered why "map { map { $_ => $_ } @{$_} } ( [ 1..4 ], [ 5..6 > ], [ 7..10 ] )" does have 2 identical values in the inner map?
This example doesn't seem relevant to me because it only uses scalar $_, while the problem is with the @_ array. Show quoted text
> @_ is always the list of arguments when entering a SUB (not an XSUB). > That works as designed, your code is wrong.
Normal execution indeed works as designed; what does not work is that if you run the same code under the perl debugger, you get strange code references in the @_ array. Regards, Laurent D.
Download (untitled) / with headers
text/plain 1.2k
On Sun Apr 30 15:00:53 2017, laurent.dami@free.fr wrote: Show quoted text
> Hi Jens, > > Maybe my bug description wasn't clear enough, but I think there is some > misunderstanding here.
There is no misunderstanding - I just hoped the example was clear enough. It wasn't, but this was my fault. Show quoted text
> > Ever wondered why "map { map { $_ => $_ } @{$_} } ( [ 1..4 ], [ 5..6 > > ], [ 7..10 ] )" does have 2 identical values in the inner map?
> > This example doesn't seem relevant to me because it only uses scalar $_, > while the problem is with the @_ array. >
> > @_ is always the list of arguments when entering a SUB (not an XSUB). > > That works as designed, your code is wrong.
> Normal execution indeed works as designed; what does not work is that if > you run the same code under the perl debugger, you get strange code > references in the @_ array.
Please try following snipped: perl -MData::Dumper -le 'sub s1 { print Dumper \@_; s2( qw(a b c) ) }; sub s2 { print Dumper \@_ }; s1( qw(x y z) )' perl -MData::Dumper -le 'sub s1 { my $ds = sub { print Dumper \@_ }; print Dumper \@_; $ds->( qw(a b c) ) }; s1( qw(x y z) )' However, $_ and @_ have a special meaning in loops and subs. If above examples aren't clear enough, this is likely a case for an irc channel #perl-help or so. Cheers, Jens


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.