develooper Front page | perl.perl5.porters | Postings from December 2010

[perl #81078] [PATCH] UNIVERSAL(3p) manual: recommend plain ref() rather than Scalar::Util

Thread Next
Ingo Schwarze
December 21, 2010 13:10
[perl #81078] [PATCH] UNIVERSAL(3p) manual: recommend plain ref() rather than Scalar::Util
Message ID:
# New Ticket Created by  Ingo Schwarze 
# Please include the string:  [perl #81078]
# in the subject line of all future correspondence about this issue. 
# <URL: >


since Scalar::Util::reftype() seems obsolete, i suggest that
the UNIVERSAL(3p) manual ought to recommend using the builtin
function ref() instead.


Ingo Schwarze <> | Software Engineer
Astaro GmbH & Co. KG | | 76227 Karlsruhe | Germany

 lib/ |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/ b/lib/
index 8960462..d3d843a 100644
--- a/lib/
+++ b/lib/
@@ -201,11 +201,9 @@ a function to determine the type of a reference:
   $yes = isa "Foo", "Bar";
 The problem is that this code will I<never> call an overridden C<isa> method in
-any class.  Instead, use C<reftype> from L<Scalar::Util> for the first case:
+any class.  Instead, use the builtin function C<ref> for the first case:
-  use Scalar::Util 'reftype';
-  $yes = reftype( $h ) eq "HASH";
+  $yes = ref($h) eq "HASH";
 and the method form of C<isa> for the second:

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