in reply to Re: Re: Determining the true type of a reference
in thread Determining the true type of a reference
Unless we bring overloading in :-). Consider:
{ package FakeScalar; use overload '${}' => sub { \(shift->{scalar}) }; sub new { bless { scalar => undef }, shift }; }; use Scalar::Util qw(reftype); my $scalar = FakeScalar->new; print "reftype(FakeScalar) = ", reftype($scalar), "\n"; print prt_typ( [ $scalar => 'FakeScalar'] ); __END__ # produces reftype(FakeScalar) = HASH ref(FakeScalar) = FakeScalar FakeScalar is SCALAR
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re^3: Determining the true type of a reference
by bobn (Chaplain) on May 26, 2003 at 01:44 UTC | |
by adrianh (Chancellor) on May 26, 2003 at 10:11 UTC |