in reply to Recreating hash from Data::Dumper text

Incidentally, if you're merely trying to save a structure to a disk file, you should take a look at Storable; it's more space-efficient and doesn't need to be fed to 'eval' (always a risky proposition) for deserialization. Plus, I think it's core (though I'm uncertain when it became so).
--Stevie-O
$"=$,,$_=q>|\p4<6 8p<M/_|<('=> .q>.<4-KI<l|2$<6%s!<qn#F<>;$, .=pack'N*',"@{[unpack'C*',$_] }"for split/</;$_=$,,y[A-Z a-z] {}cd;print lc

Replies are listed 'Best First'.
Re: Re: Recreating hash from Data::Dumper text
by PodMaster (Abbot) on Apr 15, 2004 at 06:36 UTC
    E:\>corelist Storable -a
    
    Storable  was first released with perl 5.007003
      5.007003   1.015
      5.008      2.04
      5.008001   2.08
      5.008002   2.08
      5.009      2.08
    
    

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re: Re: Recreating hash from Data::Dumper text
by theguvnor (Chaplain) on Apr 15, 2004 at 19:29 UTC

    Thanks for the tip; I looked briefly into Storable and it appears it does use eval internally. From the documentation:

    Since Storable version 2.05, CODE references may be serialized with the help of B::Deparse. To enable this feature, set $Storable::Deparse to a true value. To enable deserializazion, $Storable::Eval should be set to a true value. Be aware that deserialization is done through eval, which is dangerous if the Storable file contains malicious data. You can set $Storable::Eval to a subroutine reference which would be used instead of eval. See below for an example using a Safe compartment for deserialization of CODE references.

    Still useful, but subject to the caveats with any use of eval.

    [Jon]