Skip Menu |
 

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

Report information
The Basics
Id: 127963
Status: open
Priority: 0/
Queue: Scalar-List-Utils

People
Owner: Nobody in particular
Requestors: rkleemann [...] gmail.com
Cc:
AdminCc:

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



Subject: reftype on Regexp doesn't behave as expected
Date: Fri, 7 Dec 2018 14:40:37 -0800
To: bug-Scalar-List-Utils [...] rt.cpan.org
From: Bob Kleemann <rkleemann [...] gmail.com>
Download (untitled) / with headers
text/plain 395b
The output of "perl -MScalar::Util=reftype -E 'say reftype(qr/abc/)'" does not return the same value as "perl -E 'say ref(qr/abc/)'"? Specifically, the first returns the all-capitals REGEXP, whereas the latter returns the mixed-case Regexp. I would expect that the return values for reftype would either match those as documented for ref, or that the documentation would note the differences.
Download (untitled) / with headers
text/plain 629b
On Fri Dec 07 17:41:06 2018, rkleemann@gmail.com wrote: Show quoted text
> The output of "perl -MScalar::Util=reftype -E 'say reftype(qr/abc/)'" does > not return the same value as "perl -E 'say ref(qr/abc/)'"? Specifically, > the first returns the all-capitals REGEXP, whereas the latter returns the > mixed-case Regexp. I would expect that the return values for reftype would > either match those as documented for ref, or that the documentation would > note the differences.
The values returned by qr// are REGEXP references blessed into the Regexp package. ref returns a different value than reftype for these, just like any other object.
Subject: Re: [rt.cpan.org #127963] reftype on Regexp doesn't behave as expected
Date: Mon, 10 Dec 2018 11:29:13 -0800
To: bug-Scalar-List-Utils [...] rt.cpan.org
From: Bob Kleemann <rkleemann [...] gmail.com>
Download (untitled) / with headers
text/plain 1.4k
I wasn't aware that qr// returned a blessed reference, rather than just a reference. It's not obvious from any of the documentation that I've read (Scalar::Utils, perlop, and perlfunc, among others) that the difference is between the underlying structure and the pseudo-class (perldoc doesn't seem to know about the Regexp package/class). Please update the documentation to note the single, unexpected difference from ref: Note: reftype(qr/abc/) differs from the ref(qr/abc/). The former returns the name of the underlying structure, in all capitals: "REGEXP"; while the latter returns the name of the pseudo-class in mixed case: "Regexp". On Sun, Dec 9, 2018 at 3:18 AM Graham Knop via RT < bug-Scalar-List-Utils@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=127963 > > > On Fri Dec 07 17:41:06 2018, rkleemann@gmail.com wrote:
> > The output of "perl -MScalar::Util=reftype -E 'say reftype(qr/abc/)'"
> does
> > not return the same value as "perl -E 'say ref(qr/abc/)'"? Specifically, > > the first returns the all-capitals REGEXP, whereas the latter returns the > > mixed-case Regexp. I would expect that the return values for reftype
> would
> > either match those as documented for ref, or that the documentation would > > note the differences.
> > The values returned by qr// are REGEXP references blessed into the Regexp > package. ref returns a different value than reftype for these, just like > any other object. >


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.