Subject: | Issue with AI::Categorizer::Storable |
Date: | Mon, 16 Mar 2009 13:03:02 -0400 |
To: | <bug-AI-Categorizer [...] rt.cpan.org> |
From: | "Cultrera, Steve (Heritage Holdings, ACT)" <Steve.Cultrera [...] thehartford.com> |
Hi,
While not really a bug, the fact that save_state removes everything in
the $path argument makes it a dangerous method. I thought save_state
would just write some kind of file to $path, but it removes everything
in $path and everything underneath it in the directory structure!
Regardless, I appreciate the work that went into AI::Categorizer and
into making it available. Still, there probably should at least be some
mention of this behavior in the documentation.
Code from Storable.pm:
sub save_state {
my ($self, $path) = @_;
if (-e $path) {
File::Path::rmtree($path) or die "Couldn't overwrite $path: $!";
}
mkdir($path, 0777) or die "Can't create $path: $!";
Storable::nstore($self, File::Spec->catfile($path, 'self'));
}
Steve Cultrera
Sr. Business Information Consultant
Heritage Holdings Actuarial
860.520.2764
************************************************************
This communication, including attachments, is for the exclusive use of addressee and may contain proprietary, confidential and/or privileged information. If you are not the intended recipient, any use, copying, disclosure, dissemination or distribution is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this communication and destroy all copies.
************************************************************