in reply to Re: Pragma (more) like Java's 'import'?
in thread Pragma (more) like Java's 'import'?

++, but I'm fairly certian that you want %s there, or even better *s. OTOH, using a * would kill $main::Baz as well as making an alias for the package. (* is better then % because it aliases, rather then coppies, the symbol tables.)


Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

  • Comment on Re: Re: Pragma (more) like Java's 'import'?

Replies are listed 'Best First'.
Re: Re: Re: Pragma (more) like Java's 'import'?
by broquaint (Abbot) on May 11, 2003 at 22:45 UTC
    but I'm fairly certian that you want %s there, or even better *s
    Assigning with %Foo::Bar::Baz:: will copy the various globs in the symbol table, which should suffice, copying the glob is more efficient and explicitly accessing the glob would do the same job e.g
    ## copy every glob %main::Baz:: = %Foo::Bar::Baz::; ## copy the Baz:: glob $main::{"Baz::"} = $Foo::Bar::{"Baz::"}; ## explicitly reference the glob *main::Baz:: = *Foo::Bar::Baz::
    They all achieve the same goal (roughly), whereas the first example does a complete copy of the symbol table, the second two just create a reference. So one of the second two would be the desired behaviour in this case.
    HTH

    _________
    broquaint

      D'oh!