in reply to (DON'T) use Data::Dumper to implement Object persistence
You really, really want to be careful using this as method of serialization. Firstly because the eval can cause any code to be executed on your machine you don't want to find that someone has substituted the content of your file for system('rm -rf /'); or something equally evil. Secondly because of the way that nearly all Perl serialization schemes work with respect to objects you are subject to the more subtle attack that I discussed at yapc::EU 2001 - whereby default destructors for existing classes can be inadvertantly used against you. The example there shows a serialized hash with duplicate keys whose values are hand crafted TempFile objects - the destructor of the TempFile deletes a file .... you can guess the rest.
/J\
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: use Data::Dumper to implement Object persistence
by tucano (Scribe) on Apr 28, 2005 at 09:32 UTC |