in reply to Another "Find the bug!" Node

Do a deep copy, not a shallow copy.

package Package2; use Storable 'dclone'; use base 'Exporter'; use Package1 ':all'; our @EXPORT_OK = ( @{ dclone( \ @Package1::EXPORT_OK ) }, 'foobar' ); our %EXPORT_TAGS = %{ dclone( \ %Package1::EXPORT_TAGS ) }; push @{ $EXPORT_TAGS{all} } => 'foobar'; sub foobar { 'foobar' } 1;

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Replies are listed 'Best First'.
Re^2: Another "Find the bug!" Node
by ikegami (Patriarch) on Sep 27, 2006 at 17:08 UTC
    dclone is not needed for @EXPORT_OK.

      It is good policy to not care about the contents. Of course it isn't needed: I can see that. Once I'd already paid the cost of loading getting Storable::dclone it made sense to apply it consistently to the problem. Anything less would be kind of irresponsible.

      ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

        Are you suggesting dclone should be used on all assignments when its loaded? The content of @EXPORT_OK is treated as strings. It's not a problem if two @EXPORT_OK have "HASH(0x1abef80)" in them, so dclone is not needed, and not using it is not irresponsible.