Re: generic refcounted object perl binding

YangXi <jiandingzhe msn com> writes:

Even if we have to bless the referenCE, does the blessing actually
bind package subs on the referenT?

I think the blessing is a property of the underlying hash (or whatever).
Eg. couple of lines below.

It seems I should create
an SV reference for my HV, and bless that SV.However, what should I do
if I don't want to have a SV reference?

The oopery all seems geared towards sv ref to a hash or whatever.
I expect you could discard the sv after blessing if you really wanted
to keep only the hash.

my %h;
my $r = \%h;
my $t = \%h;
bless $r, 'Foo';
print ref $r,"\n";
print ref $t,"\n";

use Devel::Peek;
print Devel::Peek::Dump(\%h);
print Devel::Peek::Dump($t);

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]