in reply to Re: Re: Perl Object as Hash, Array & Scalar in the same time! ( $O->{k} | $O->[0] | $O )
in thread Perl Object as Hash, Array & Scalar in the same time! ( $O->{k} | $O->[0] | $O )

No, clearly every gensym object occupies a new GEN# slot in the Symbol package. Also - DESTROY is completely innappropriate here. You cannot call ->DESTROY on an object and have it actually free the object. The ->DESTROY method is called by perl when the object is being destroyed - you can't provoke it by calling it yourself.

perl -MB -MSymbol -e '$,=$\="\n";push @A,gensym for 0 .. 10;@B=map B::svref_2object($_), @A; print $_->STASH->NAME."::".$_->NAME for @B'
  • Comment on Re: Re: Re: Perl Object as Hash, Array & Scalar in the same time! ( $O->{k} | $O->[0] | $O )
  • Download Code

Replies are listed 'Best First'.
Re: Re: Re: Re: Perl Object as Hash, Array & Scalar in the same time! ( $O->{k} | $O->[0] | $O )
by gmpassos (Priest) on May 10, 2003 at 02:56 UTC
    I said that the DESTROY is to DESTROY the GEN# with the OBJ (in the same time), when Perl make the garbage collection of the block. Not to call it by hand!

    Graciliano M. P.
    "The creativity is the expression of the liberty".