[Israel.pm] how to get the data type of blessed object
Gaal Yahas
gaal at forum2.org
Tue Jul 13 11:47:34 PDT 2004
On Tue, Jul 13, 2004 at 08:46:38PM +0300, Itamar Elem wrote:
> > >how can i get the datatype(ARRAY,HASH,....) of blessed object
[Gabor]
> >print ref $x;
[Itamar]
> use attributes;
>
> print attributes::reftype $x;
[Gaal]
Since attributes.pm is "still evolving", if you want this kind of
approach you'd better use Scalar::Util::reftype instead.
Mikhael suggests stringifying the reference, but as he himself notes
this is not robust against ""-overloading.
I usually use the ref builtin.
--
Gaal Yahas <gaal at forum2.org>
http://gaal.livejournal.com/
More information about the Perl
mailing list