SPUG:object in a hash

ced at carios2.ca.boeing.com ced at carios2.ca.boeing.com
Wed Jun 4 13:04:50 CDT 2003


Hash keys always get stringified and this morphing breaks
the original object reference. There's probably an alternative 
(and better structure) you could use that'd avoid storing 
object ref's as hash keys. 

However, FreezeThaw is a possibility if you're stuck:

  use FreezeThaw qw( freeze thaw );

  $INFOHASH{ freeze( my $obj = new Foo ) }++;
  ...

  foreach my $key ( keys %INFOHASH) {
     my( $obj ) = thaw( $key );
     ... 
  }


Rgds,
--
Charles DeRykus



More information about the spug-list mailing list