in reply to Re: Object::MultiType - Perl Objects as Hash, Array & Scalar in the same time!
in thread Object::MultiType - Perl Objects as Hash, Array & Scalar in the same time!

Many thanks for all the work to test GLOB through Symbol. But now I'm fully avoiding GLOB and Symbol::.

I have created a Saver object inside Object::MultiType::Saver, where this object stay inside the MultiType object, and now there is no need of GLOB or any extra thing.

Thanks (to you and PodMaster) for the previous advices to avoid GLOB! ;-P

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

  • Comment on Re: Re: Object::MultiType - Perl Objects as Hash, Array & Scalar in the same time!

Replies are listed 'Best First'.
Re: Re: Re: Object::MultiType - Perl Objects as Hash, Array & Scalar in the same time!
by diotalevi (Canon) on May 12, 2003 at 13:33 UTC

    As I recall, you can't handle globs this way and expect to get unique ones. As I recall localizing a symbol table entry and returning a reference will cause multiple uses to merge into a single shared instance. You still need to use gemsym() or my lexglob() for handling that $this->{g} instance.

    sub new { my $class = shift ; local(*NULL); my $this = { s => \'' , a => [] , h => [] , c => sub{} , g => \*NULL , } ; bless($this,$class); return( $this ) ; }
      The *NULL is not a GLOB to be used by the user! It's just here to avoid erros!

      If the user want a glob it need to paste it:

      my $obj = Object::MultiType->new(glob => \*MYGLOB) ;
      Will add some note in the POD! ;-P

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