develooper Front page | perl.perl5.porters | Postings from September 2012

[perl #114964] [PATCH] 0d99897 Correct 'ref' func POD to fix bad behavior around 'class matching'

Thread Previous
Perl @ ResonatorSoft . org
September 19, 2012 07:58
[perl #114964] [PATCH] 0d99897 Correct 'ref' func POD to fix bad behavior around 'class matching'
Message ID:
# New Ticket Created by 
# Please include the string:  [perl #114964]
# in the subject line of all future correspondence about this issue. 
# <URL: >

This is a bug report for perl from,
generated with the help of perlbug 1.39 running under perl 5.16.0.

>From 0d99897956d10f5c119146bb6af91aa90e7d7f25 Mon Sep 17 00:00:00 2001
From: Brendan Byrd <>
Date: Wed, 19 Sep 2012 10:32:40 -0400
Subject: [PATCH] Correct 'ref' func POD to fix bad behavior around "class
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------1.7.8.msysgit.0"

This is a multi-part message in MIME format.
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit

 pod/perlfunc.pod |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

Content-Type: text/x-patch; name="0001-Correct-ref-func-POD-to-fix-bad-behavior-around-clas.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Correct-ref-func-POD-to-fix-bad-behavior-around-clas.patch"

diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 5a2eb71..6002995 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -5652,9 +5652,9 @@ X<ref> X<reference>
 =for Pod::Functions find out the type of thing being referenced
 Returns a non-empty string if EXPR is a reference, the empty
-string otherwise.  If EXPR
-is not specified, C<$_> will be used.  The value returned depends on the
-type of thing the reference is a reference to.
+string otherwise.  If EXPR is not specified, C<$_> will be used.  The
+value returned depends on the type of thing the reference is a reference to.
 Builtin types include:
@@ -5669,8 +5669,7 @@ Builtin types include:
-If the referenced object has been blessed into a package, then that package
-name is returned instead.  You can think of C<ref> as a C<typeof> operator.
+You can think of C<ref> as a C<typeof> operator.
     if (ref($r) eq "HASH") {
         print "r is a reference to a hash.\n";
@@ -5687,6 +5686,16 @@ to a L<version string|perldata/"Version Strings">.
 The result C<Regexp> indicates that the argument is a regular expression
 resulting from C<qr//>.
+If the referenced object has been blessed into a package, then that package
+name is returned instead.  But don't use that, as it's now considered 
+"bad practice".  For one reason, an object could be using a class called
+C<Regexp> or C<IO>, or even C<HASH>.  Also, c<ref> doesn't take into account
+subclasses, like C<isa> does.
+Instead, use C<blessed> (in the L<Scalar::Util> module) for boolean checks,
+and C<isa> for specific class checks.  (See L<perlobj> for details and a
+C<blessed/isa> example.)
 See also L<perlref>.
 =item rename OLDNAME,NEWNAME


Site configuration information for perl 5.16.0:

Configured by strawberry-perl at Mon May 21 22:08:30 2012.

Summary of my perl5 (revision 5 version 16 subversion 0) configuration:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname='Win32 strawberry-perl #1 Mon May 21 22:07:30 2012 i386'
    hint=recommended, useposix=true, d_sigaction=undef
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
    cc='gcc', ccflags =' -s -O2 -DWIN32  -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitfields',
    optimize='-s -O2',
    ccversion='', gccversion='4.6.3', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='long long', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='g++', ldflags ='-s -L"C:\strawberry\perl\lib\CORE" -L"C:\strawberry\c\lib"'
    libpth=C:\strawberry\c\lib C:\strawberry\c\i686-w64-mingw32\lib
    libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
    perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
    libc=, so=dll, useshrplib=true, libperl=libperl516.a
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-mdll -s -L"C:\strawberry\perl\lib\CORE" -L"C:\strawberry\c\lib"'

Locally applied patches:

@INC for perl 5.16.0:

Environment for perl 5.16.0:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\Windows\SYSTEM32;C:\Windows;C:\Windows\SYSTEM32\WBEM;C:\Windows\SYSTEM32\WINDOWSPOWERSHELL\V1.0\;C:\STRAWBERRY\C\BIN;C:\STRAWBERRY\PERL\SITE\BIN;C:\STRAWBERRY\PERL\BIN;C:\CYGWIN\BIN;C:\CYGWIN\USR\BIN;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Graphviz 2.28\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files\Nmap
    PERL_BADLANG (unset)
    SHELL (unset)

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About