⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 storable.pm

📁 AI::Categorizer is a framework for automatic text categorization. It consists of a collection of Per
💻 PM
字号:
package AI::Categorizer::Storable;use strict;use Storable;use File::Spec ();use File::Path ();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'));}sub restore_state {  my ($package, $path) = @_;  return Storable::retrieve(File::Spec->catfile($path, 'self'));}1;__END__=head1 NAMEAI::Categorizer::Storable - Saving and Restoring State=head1 SYNOPSIS  $object->save_state($path);  ... time passes ...  $object = Class->restore_state($path);  =head1 DESCRIPTIONThis class implements methods for storing the state of an object to afile and restoring from that file later.  In C<AI::Categorizer> it isgenerally used in order to let data persist across multipleinvocations of a program.=head1 METHODS=over 4=item save_state($path)This object method saves the object to disk for later use.  TheC<$path> argument indicates the place on disk where the object shouldbe saved.=item restore_state($path)This class method reads the file specified by C<$path> and returns theobject that was previously stored there using C<save_state()>.=head1 AUTHORKen Williams, ken@mathforum.org=head1 COPYRIGHTCopyright 2000-2003 Ken Williams.  All rights reserved.This library is free software; you can redistribute it and/ormodify it under the same terms as Perl itself.=head1 SEE ALSOAI::Categorizer(3), Storable(3)=cut

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -