No, that doesn't work.
{ package Foo; use overload '""' => sub { 'Bar' }; sub new { bless({}, shift) } } { my $value = Foo->new; # We want the true type of blessed objects like XML::DOM::Document my $true_type; if(ref($value)) { $true_type = scalar($value); $true_type =~ s/.*=(\w*).*/$1/; } print ref($value)," is really an $true_type\n"; }
Foo is really an Bar
But it's really a hash.
Scalar::Util's blessed, reftype and refaddr provide the desired $class, $type and $addr respectively.
In reply to Re^2: Is reference blessed?
by ikegami
in thread Is reference blessed?
by gildir
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |