Skip Menu |
Report information
Id: 133751
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: djerius <djerius [at] cpan.org>
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: low
Type: core
Perl Version: 5.28.1
Fixed In: (no value)

Attachments


To: perlbug [...] perl.org
From: djerius [...] cpan.org
Date: Thu, 3 Jan 2019 12:15:46 -0500
Subject: ref function returns 'Regexp', not 'REGEXP' for qr//
Download (untitled) / with headers
text/plain 5.3k
This is a bug report for perl from djerius@cpan.org, generated with the help of perlbug 1.41 running under perl 5.28.1. ----------------------------------------------------------------- [Please describe your issue here] The documentation for the ref() function indicates that it returns 'REGEXP' for regular expressions. Actually, it returns 'Regexp': % perl -le 'print ref( qr// )' Regexp As far as I can recall (and verified with Perl 5.8.8) it has always retrned 'Regexp'. [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=low --- Site configuration information for perl 5.28.1: Configured by dj at Mon Dec 17 10:30:49 EST 2018. Summary of my perl5 (revision 5 version 28 subversion 1) configuration: Platform: osname=linux osvers=4.9.0-8-amd64 archname=x86_64-linux_debian-9-thread-multi uname='linux macabre 4.9.0-8-amd64 #1 smp debian 4.9.110-3+deb9u5 (2018-09-30) x86_64 gnulinux ' config_args='-de -Dprefix=/proj/axaf/ots/pkgs/perl-5.28/x86_64-linux_debian-9 -Uinstallusrbinperl -Dperladmin=none -Dlocincpth=/proj/axaf/ots/include -Darchname=x86_64-linux_debian-9 -Dusethreads -Dotherlibdirs=/proj/axaf/simul/lib/perl5:/proj/axaf/simul/x86_64-linux_debian-9/lib/perl5 -Dloclibpth=/proj/axaf/ots/x86_64-linux_debian-9/lib -Dglibpth=/lib /usr/lib -Dldflags=-L/proj/axaf/ots/x86_64-linux_debian-9/lib -Wl,-rpath=/proj/axaf/ots/x86_64-linux_debian-9/lib -Duseshrplib' hint=recommended useposix=true d_sigaction=define useithreads=define usemultiplicity=define use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n default_inc_excludes_dot=define bincompat5005=undef Compiler: cc='cc' ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/proj/axaf/ots/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2' optimize='-O2' cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/proj/axaf/ots/include' ccversion='' gccversion='6.3.0 20170516' gccosandvers='' intsize=4 longsize=8 ptrsize=8 doublesize=8 byteorder=12345678 doublekind=3 d_longlong=define longlongsize=8 d_longdbl=define longdblsize=16 longdblkind=3 ivtype='long' ivsize=8 nvtype='double' nvsize=8 Off_t='off_t' lseeksize=8 alignbytes=8 prototype=define Linker and Libraries: ld='cc' ldflags ='-L/proj/axaf/ots/x86_64-linux_debian-9/lib -Wl,-rpath=/proj/axaf/ots/x86_64-linux_debian-9/lib -fstack-protector-strong' libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/6/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /proj/axaf/ots/x86_64-linux_debian-9/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib libs=-lpthread -lnsl -lgdbm -ldl -lm -lcrypt -lutil -lc -lgdbm_compat perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc libc=libc-2.24.so so=so useshrplib=true libperl=libperl.so gnulibc_version='2.24' Dynamic Linking: dlsrc=dl_dlopen.xs dlext=so d_dlsymun=undef ccdlflags='-Wl,-E -Wl,-rpath,/proj/axaf/ots/pkgs/perl-5.28/x86_64-linux_debian-9/lib/5.28.1/x86_64-linux_debian-9-thread-multi/CORE' cccdlflags='-fPIC' lddlflags='-shared -O2 -L/proj/axaf/ots/x86_64-linux_debian-9/lib -fstack-protector-strong' --- @INC for perl 5.28.1: /proj/axaf/simul/lib/perl5/x86_64-linux_debian-9-thread-multi /proj/axaf/simul/lib/perl5 /home/dj/research/lib/perl5 /proj/axaf/ots/pkgs/perl-5.28/x86_64-linux_debian-9/lib/site_perl/5.28.1/x86_64-linux_debian-9-thread-multi /proj/axaf/ots/pkgs/perl-5.28/x86_64-linux_debian-9/lib/site_perl/5.28.1 /proj/axaf/ots/pkgs/perl-5.28/x86_64-linux_debian-9/lib/5.28.1/x86_64-linux_debian-9-thread-multi /proj/axaf/ots/pkgs/perl-5.28/x86_64-linux_debian-9/lib/5.28.1 /proj/axaf/ots/pkgs/perl-5.28/x86_64-linux_debian-9/lib/site_perl/5.28.0/x86_64-linux_debian-9-thread-multi /proj/axaf/ots/pkgs/perl-5.28/x86_64-linux_debian-9/lib/site_perl/5.28.0 /proj/axaf/ots/pkgs/perl-5.28/x86_64-linux_debian-9/lib/site_perl /proj/axaf/simul/lib/perl5/x86_64-linux_debian-9-thread-multi /proj/axaf/simul/lib/perl5 /proj/axaf/simul/x86_64-linux_debian-9/lib/perl5 --- Environment for perl 5.28.1: HOME=/home/dj LANG=en_US.UTF-8 LANGUAGE (unset) LD_LIBRARY_PATH=/soft/SYBASE15.7/DataAccess64/ODBC/lib:/soft/SYBASE15.7/DataAccess/ODBC/lib:/soft/SYBASE15.7/OCS-15_0/lib:/soft/SYBASE15.7/OCS-15_0/lib3p64:/soft/SYBASE15.7/OCS-15_0/lib3p: LOGDIR (unset) PATH=/home/dj/.plenv/libexec:/home/dj/.plenv/plugins/link-axaf/bin:/home/dj/.plenv/plugins/perl-build/bin:/home/dj/.plenv/plugins/plenv-contrib/bin:/soft/SYBASE15.7/OCS-15_0/bin:/home/dj/.rbenv/shims:/home/dj/.rbenv/bin:/home/dj/.pyenv/plugins/pyenv-virtualenv/shims:/home/dj/.pyenv/shims:/home/dj/.pyenv/bin:/home/dj/.plenv/shims:/home/dj/.plenv/bin:/home/dj/root/bin:/home/dj/root/bin/hosts:/home/dj/research/bin:/proj/axaf/ots/pkgs/perl-5.28/x86_64-linux_debian-9/bin:/proj/axaf/bin:/proj/axaf/simul/bin:/proj/axaf/simul/x86_64-linux_debian-9/bin:/proj/axaf/ots/x86_64-linux_debian-9/bin:/proj/axaf/ots/bin:/usr/local/bin:/usr/sbin:/bin:/usr/bin:/soft/saord/bin PERL5LIB=/proj/axaf/simul/lib/perl5:/home/dj/research/lib/perl5 PERL_BADLANG (unset) SHELL=/bin/bash
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 451b
On Thu, 03 Jan 2019 09:15:54 -0800, djerius wrote: Show quoted text
> The documentation for the ref() function indicates that it > returns 'REGEXP' for regular expressions. Actually, > it returns 'Regexp': > % perl -le 'print ref( qr// )' > Regexp > As far as I can recall (and verified with Perl 5.8.8) it has > always retrned 'Regexp'.
See attached patch, which also references the commit where the change from Regexp to REGEXP was done. Hope this helps, -marco-
Subject: 0001-fix-perldoc-f-ref-return-value-for-Regexp.patch
From a9acc5184fbee966b58dc71084360bfdfafc1bff Mon Sep 17 00:00:00 2001 From: Marco Fontani <MFONTANI@cpan.org> Date: Thu, 3 Jan 2019 18:24:59 +0100 Subject: [PATCH] fix "perldoc -f ref" return value for Regexp ... which was (mistakenly?) switched from Regexp to REGEXP in commit f3c710fe342032112ac92fc893f5ef050b4f7024 For RT #133751 --- pod/perlfunc.pod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 664e2a3e0c..a6273bf183 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -6378,7 +6378,7 @@ a scalar, then the return value will be one of the strings C<ARRAY>, C<HASH>, C<CODE>, C<FORMAT>, or C<IO>, indicating only which kind of object it is. If the unblessed referent is a scalar, then the return value will be one of the strings C<SCALAR>, C<VSTRING>, C<REF>, C<GLOB>, -C<LVALUE>, or C<REGEXP>, depending on the kind of value the scalar +C<LVALUE>, or C<Regexp>, depending on the kind of value the scalar currently has. Beware that these built-in type names can also be used as class names, so C<ref> returning one of these names doesn't unambiguously indicate that the referent is of the kind to which the name refers. -- 2.20.1
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 932b
On Thu, 03 Jan 2019 17:15:54 GMT, djerius wrote: Show quoted text
> > This is a bug report for perl from djerius@cpan.org, > generated with the help of perlbug 1.41 running under perl 5.28.1. > > > ----------------------------------------------------------------- > [Please describe your issue here] > > The documentation for the ref() function indicates that it > returns 'REGEXP' for regular expressions. Actually, > it returns 'Regexp': > > % perl -le 'print ref( qr// )' > Regexp > > As far as I can recall (and verified with Perl 5.8.8) it has > always returned 'Regexp'. > >
Yes. It appears that it's Scalar::Util::reftype() which returns the all-upper-case string. ##### $ perl -MScalar::Util=reftype -le 'print reftype( qr// )' REGEXP ##### List: How should we handle this? (Simplest might be to just change the documentation in pod/perlfunc.pod around line 6381.) Thank you very much. -- James E Keenan (jkeenan@cpan.org)
Date: Thu, 3 Jan 2019 21:36:40 +0100 (CET)
Subject: Re: [perl #133751] ref function returns 'Regexp', not 'REGEXP' for qr//
From: shmem <gm [...] qwurx.de>
CC: perl5-porters [...] perl.org
To: James E Keenan via RT <perlbug-followup [...] perl.org>
Download (untitled) / with headers
text/plain 1.4k
From the keyboard of James E Keenan via RT [03.01.19,09:36]: Show quoted text
> On Thu, 03 Jan 2019 17:15:54 GMT, djerius wrote:
>> >> This is a bug report for perl from djerius@cpan.org, >> generated with the help of perlbug 1.41 running under perl 5.28.1. >> >> >> ----------------------------------------------------------------- >> [Please describe your issue here] >> >> The documentation for the ref() function indicates that it >> returns 'REGEXP' for regular expressions. Actually, >> it returns 'Regexp': >> >> % perl -le 'print ref( qr// )' >> Regexp >> >> As far as I can recall (and verified with Perl 5.8.8) it has >> always returned 'Regexp'. >> >>
> > Yes. It appears that it's Scalar::Util::reftype() which returns the all-upper-case string. > > ##### > $ perl -MScalar::Util=reftype -le 'print reftype( qr// )' > REGEXP > ##### > > List: How should we handle this? (Simplest might be to just change the documentation in pod/perlfunc.pod around line 6381.)
I think it should return REGEXP, since that is consistent with the uppercase return value for other references (HASH, ARRAY, CODE). Show quoted text
> Thank you very much. > > -- > James E Keenan (jkeenan@cpan.org) > > --- > via perlbug: queue: perl5 status: open > https://rt.perl.org/Ticket/Display.html?id=133751 >
0--gg- -- _($_=" "x(1<<5)."?\n".q·/)Oo. G°\ / /\_¯/(q / ---------------------------- \__(m.====·.(_("always off the crowd"))."· ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
To: shmem <gm [...] qwurx.de>
Subject: Re: [perl #133751] ref function returns 'Regexp', not 'REGEXP' for qr//
Date: Thu, 3 Jan 2019 22:18:17 +0100
From: Leon Timmermans <fawaka [...] gmail.com>
CC: James E Keenan via RT <perlbug-followup [...] perl.org>, Perl5 Porters <perl5-porters [...] perl.org>
Download (untitled) / with headers
text/plain 527b
On Thu, Jan 3, 2019 at 9:37 PM shmem <gm@qwurx.de> wrote: Show quoted text
> > List: How should we handle this? (Simplest might be to just change the documentation in pod/perlfunc.pod around line 6381.)
> > I think it should return REGEXP, since that is consistent with the > uppercase return value for other references (HASH, ARRAY, CODE).
Unlike the examples you mention, a regexp is a blessed reference, allowing you to call methods on them (even if by default none are defined). perl -E 'sub Regexp::foo { say "HERE" }; qr//->foo Leon
To: Leon Timmermans <fawaka [...] gmail.com>
CC: shmem <gm [...] qwurx.de>, James E Keenan via RT <perlbug-followup [...] perl.org>, Perl5 Porters <perl5-porters [...] perl.org>
Subject: Re: [perl #133751] ref function returns 'Regexp', not 'REGEXP' for qr//
Date: Thu, 3 Jan 2019 22:39:51 +0100 (CET)
From: shmem <gm [...] qwurx.de>
From the keyboard of Leon Timmermans [03.01.19,22:18]: Show quoted text
> On Thu, Jan 3, 2019 at 9:37 PM shmem <gm@qwurx.de> wrote:
>>> List: How should we handle this? (Simplest might be to just change the documentation in pod/perlfunc.pod around line 6381.)
>> >> I think it should return REGEXP, since that is consistent with the >> uppercase return value for other references (HASH, ARRAY, CODE).
Ah, ok. Then probably Regexp is right, since it is, hm, a package name and not the type designator after '=' as in Foo=HASH(0xdabba00). Show quoted text
> Unlike the examples you mention, a regexp is a blessed reference, > allowing you to call methods on them (even if by default none are > defined).
Well, DESTROY is defined, although it doesn't do anything ;) </nitpick> Show quoted text
> perl -E 'sub Regexp::foo { say "HERE" }; qr//->foo > > Leon >
0--gg- -- _($_=" "x(1<<5)."?\n".q·/)Oo. G°\ / /\_¯/(q / ---------------------------- \__(m.====·.(_("always off the crowd"))."· ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Subject: Re: [perl #133751] ref function returns 'Regexp', not 'REGEXP' for qr//
Date: Thu, 3 Jan 2019 23:46:31 +0000
To: shmem <gm [...] qwurx.de>
CC: Leon Timmermans <fawaka [...] gmail.com>, James E Keenan via RT <perlbug-followup [...] perl.org>, Perl5 Porters <perl5-porters [...] perl.org>
From: Dave Mitchell <davem [...] iabyn.com>
Download (untitled) / with headers
text/plain 800b
On Thu, Jan 03, 2019 at 10:39:51PM +0100, shmem wrote: Show quoted text
> > From the keyboard of Leon Timmermans [03.01.19,22:18]:
> Ah, ok. Then probably Regexp is right, since it is, hm, a package name > and not the type designator after '=' as in Foo=HASH(0xdabba00).
I think the docs should say (as before): If the unblessed referent is a scalar, then the return value will be one of the strings C<SCALAR>, C<VSTRING>, C<REF>, C<GLOB>, C<LVALUE>, or C<REGEXP>, depending on the kind of value the scalar currently has. But append: But note that C<qr//> scalars are created already blessed, so C<ref qr/.../> will likely return C<Regexp>. -- Please note that ash-trays are provided for the use of smokers, whereas the floor is provided for the use of all patrons. -- Bill Royston
To: Dave Mitchell <davem [...] iabyn.com>
Date: Fri, 4 Jan 2019 01:11:10 +0100
Subject: Re: [perl #133751] ref function returns 'Regexp', not 'REGEXP' for qr//
From: Eirik Berg Hanssen <Eirik-Berg.Hanssen [...] allverden.no>
CC: shmem <gm [...] qwurx.de>, Leon Timmermans <fawaka [...] gmail.com>, James E Keenan via RT <perlbug-followup [...] perl.org>, Perl5 Porters <perl5-porters [...] perl.org>
Download (untitled) / with headers
text/plain 898b
On Fri, Jan 4, 2019 at 12:47 AM Dave Mitchell <davem@iabyn.com> wrote:
Show quoted text
On Thu, Jan 03, 2019 at 10:39:51PM +0100, shmem wrote:
> > From the keyboard of Leon Timmermans [03.01.19,22:18]:
> Ah, ok. Then probably Regexp is right, since it is, hm, a package name
> and not the type designator after '=' as in Foo=HASH(0xdabba00).

  Ah, indeed:

$ perl -E 'use overload; say overload::StrVal(qr//)'
Regexp=REGEXP(0x56229eba53f8)
$
 
Show quoted text
I think the docs should say (as before):

    If the unblessed referent is a scalar, then the return
    value will be one of the strings C<SCALAR>, C<VSTRING>, C<REF>, C<GLOB>,
    C<LVALUE>, or C<REGEXP>, depending on the kind of value the scalar
    currently has.

But append:

    But note that C<qr//> scalars are created already blessed, so
    C<ref qr/.../> will likely return C<Regexp>.

  A good note, if you ask me.


Eirik
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 883b
On Thu, 03 Jan 2019 15:46:45 -0800, davem wrote: Show quoted text
> On Thu, Jan 03, 2019 at 10:39:51PM +0100, shmem wrote:
> > > From the keyboard of Leon Timmermans [03.01.19,22:18]:
> > Ah, ok. Then probably Regexp is right, since it is, hm, a package name > > and not the type designator after '=' as in Foo=HASH(0xdabba00).
> > I think the docs should say (as before): > > If the unblessed referent is a scalar, then the return > value will be one of the strings C<SCALAR>, C<VSTRING>, C<REF>, C<GLOB>, > C<LVALUE>, or C<REGEXP>, depending on the kind of value the scalar > currently has. > > But append: > > But note that C<qr//> scalars are created already blessed, so > C<ref qr/.../> will likely return C<Regexp>.
Interesting: $ perl -le '$x = qr//; $y = $$x; print ref \$y' REGEXP I did not realize you could get that with pure Perl. -- Father Chrysostomos
CC: shmem <gm [...] qwurx.de>, Leon Timmermans <fawaka [...] gmail.com>, James E Keenan via RT <perlbug-followup [...] perl.org>, Perl5 Porters <perl5-porters [...] perl.org>
From: demerphq <demerphq [...] gmail.com>
Date: Fri, 4 Jan 2019 17:04:24 +0100
Subject: Re: [perl #133751] ref function returns 'Regexp', not 'REGEXP' for qr//
To: Dave Mitchell <davem [...] iabyn.com>
Download (untitled) / with headers
text/plain 1.1k
On Fri, 4 Jan 2019 at 00:46, Dave Mitchell <davem@iabyn.com> wrote: Show quoted text
> > On Thu, Jan 03, 2019 at 10:39:51PM +0100, shmem wrote:
> > > From the keyboard of Leon Timmermans [03.01.19,22:18]:
> > Ah, ok. Then probably Regexp is right, since it is, hm, a package name > > and not the type designator after '=' as in Foo=HASH(0xdabba00).
FWIW, this is a historical issue. Way back in time before Nicholas Clark converted qr// objects to first class types they were blessed SCALAR references. The blessing I believe was to distinguish them from normal SCALAR refs. When we introduced the REGEXP type Show quoted text
> I think the docs should say (as before): > > If the unblessed referent is a scalar, then the return > value will be one of the strings C<SCALAR>, C<VSTRING>, C<REF>, C<GLOB>, > C<LVALUE>, or C<REGEXP>, depending on the kind of value the scalar > currently has. > > But append: > > But note that C<qr//> scalars are created already blessed, so > C<ref qr/.../> will likely return C<Regexp>.
Would it be worth mentioning Scalar::Util::reftype() here as well? Yves -- perl -Mre=debug -e "/just|another|perl|hacker/"
To: demerphq <demerphq [...] gmail.com>, Dave Mitchell <davem [...] iabyn.com>
Subject: Re: [perl #133751] ref function returns 'Regexp', not 'REGEXP' for qr//
Date: Sat, 5 Jan 2019 23:46:14 +0200
From: Sawyer X <xsawyerx [...] gmail.com>
CC: shmem <gm [...] qwurx.de>, Leon Timmermans <fawaka [...] gmail.com>, James E Keenan via RT <perlbug-followup [...] perl.org>, Perl5 Porters <perl5-porters [...] perl.org>
Download (untitled) / with headers
text/plain 1.1k
On 1/4/19 6:04 PM, demerphq wrote: Show quoted text
> On Fri, 4 Jan 2019 at 00:46, Dave Mitchell <davem@iabyn.com> wrote:
>> On Thu, Jan 03, 2019 at 10:39:51PM +0100, shmem wrote:
>>>> From the keyboard of Leon Timmermans [03.01.19,22:18]:
>>> Ah, ok. Then probably Regexp is right, since it is, hm, a package name >>> and not the type designator after '=' as in Foo=HASH(0xdabba00).
> FWIW, this is a historical issue. Way back in time before Nicholas > Clark converted qr// objects to first class types they were blessed > SCALAR references. The blessing I believe was to distinguish them from > normal SCALAR refs. When we introduced the REGEXP type >
>> I think the docs should say (as before): >> >> If the unblessed referent is a scalar, then the return >> value will be one of the strings C<SCALAR>, C<VSTRING>, C<REF>, C<GLOB>, >> C<LVALUE>, or C<REGEXP>, depending on the kind of value the scalar >> currently has. >> >> But append: >> >> But note that C<qr//> scalars are created already blessed, so >> C<ref qr/.../> will likely return C<Regexp>.
+1 Show quoted text
> Would it be worth mentioning Scalar::Util::reftype() here as well?
+1
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.2k
On Sat, 05 Jan 2019 13:46:31 -0800, xsawyerx@gmail.com wrote: Show quoted text
> > On 1/4/19 6:04 PM, demerphq wrote:
> > On Fri, 4 Jan 2019 at 00:46, Dave Mitchell <davem@iabyn.com> wrote:
> >> I think the docs should say (as before): > >> > >> If the unblessed referent is a scalar, then the return > >> value will be one of the strings C<SCALAR>, C<VSTRING>, C<REF>, > >> C<GLOB>, > >> C<LVALUE>, or C<REGEXP>, depending on the kind of value the scalar > >> currently has. > >> > >> But append: > >> > >> But note that C<qr//> scalars are created already blessed, so > >> C<ref qr/.../> will likely return C<Regexp>.
> > > +1
See the attached patch. Show quoted text
> >
> > Would it be worth mentioning Scalar::Util::reftype() here as well?
> > > +1
Immediately following this paragraph: The ambiguity between built-in type names and class names significantly limits the utility of C<ref>. For unambiguous information, use L<C<Scalar::Util::blessed()>|Scalar::Util/blessed> for information about blessing, and L<C<Scalar::Util::reftype()>|Scalar::Util/reftype> for information about physical types. Use L<the C<isa> method|UNIVERSAL/C<< $obj->isa( TYPE ) >>> for class membership tests, though one must be sure of blessedness before attempting a method call. I don't think it needs another mention. Tony
Subject: 0001-perl-133751-qr-is-already-blessed.patch
From 818ed1fc594998f6295c8bf03ccc5c7c8e27592a Mon Sep 17 00:00:00 2001 From: Tony Cook <tony@develop-help.com> Date: Wed, 16 Jan 2019 09:42:16 +1100 Subject: (perl #133751) qr// is already blessed --- pod/perlfunc.pod | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 7c37a0e775..973a2612d7 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -6379,7 +6379,9 @@ C<HASH>, C<CODE>, C<FORMAT>, or C<IO>, indicating only which kind of object it is. If the unblessed referent is a scalar, then the return value will be one of the strings C<SCALAR>, C<VSTRING>, C<REF>, C<GLOB>, C<LVALUE>, or C<REGEXP>, depending on the kind of value the scalar -currently has. Beware that these built-in type names can also be used as +currently has. But note that C<qr//> scalars are created already +blessed, so C<ref qr/.../> will likely return C<Regexp>. Beware that +these built-in type names can also be used as class names, so C<ref> returning one of these names doesn't unambiguously indicate that the referent is of the kind to which the name refers. -- 2.11.0
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 790b
On Tue, 15 Jan 2019 14:45:47 -0800, tonyc wrote: Show quoted text
> On Sat, 05 Jan 2019 13:46:31 -0800, xsawyerx@gmail.com wrote:
> > > > On 1/4/19 6:04 PM, demerphq wrote:
> > > On Fri, 4 Jan 2019 at 00:46, Dave Mitchell <davem@iabyn.com> wrote:
> > >> I think the docs should say (as before): > > >> > > >> If the unblessed referent is a scalar, then the return > > >> value will be one of the strings C<SCALAR>, C<VSTRING>, C<REF>, > > >> C<GLOB>, > > >> C<LVALUE>, or C<REGEXP>, depending on the kind of value the scalar > > >> currently has. > > >> > > >> But append: > > >> > > >> But note that C<qr//> scalars are created already blessed, so > > >> C<ref qr/.../> will likely return C<Regexp>.
> > > > > > +1
> > See the attached patch.
Applied as 4829a1eae86ed3e8609d4c93e7c8f8800785c4bb. Tony
Download (untitled) / with headers
text/plain 313b
Thank you for filing this report. You have helped make Perl better. With the release today of Perl 5.30.0, this and 160 other issues have been resolved. Perl 5.30.0 may be downloaded via: https://metacpan.org/release/XSAWYERX/perl-5.30.0 If you find that the problem persists, feel free to reopen this ticket.


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

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org