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.
>