Perrin Harkins wrote:
> On Wed, 2006-03-15 at 12:23 -0500, Geoffrey Young wrote:
> 
>>I actually thing that would be somewhat common.  and as I understand things,
>>the fix would require the middle step to be
>>
>>  -- next handler
>>  my $o = $r->pnotes('foo');
>>  $o->set(bar => 1);          # sets $o->{_bar} = 1
>>  $r->pnotes(foo => $o);
>>
>>in order for $o to maintain it's internal state.  is that right?  if so, I
>>don't like that very much.

It's not right. You are confusing scalars with references in that example.

> I agree, cloning is not the answer.

Definitely not.

>  What you want really want here is
> for it to behave like a normal perl variable assignment, i.e. if you
> assign a reference, it stays a reference,

And the refcount goes up by 1.

> and if you assign a value,
> it's just a value, not a double-secret-probation reference.  I don't
> think it's a good idea to change this unless it can be done that way.

Exactly, the behaviour of

$r->pnotes(foo => $bar);

Should be equivalent in all respects to
$pnotes{foo} = $bar;

No magic, no trickery.

--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to