Author image Masatoshi Mizuno
and 1 contributors


Egg::Model::FsaveDate - Model to preserve arbitrary text data according to date.


  my $fs= $e->model('fsavedate');
  my $output_path= $fs->save( <<END_TEXT );
  save data.


The data that wants to be preserved in the file is preserved separately for the directory of every the date.

To use it, 'FsaveDate' is added to the MODEL setting of the configuration of the project.

  % vi /path/to/MyApp/lib/MyApp/
   MODEL=> [
     [ FsaveDate => {
         base_path => ...........
         } ],

Please generate the controller module with Egg::Helper::Model::FsaveDate when you want to customize processing.

   % cd /path/to/MyApp/lib/bin
   % ./ M::FsaveDate

The antecedent of this module is 'Egg::Plugin::BackUP::Easy'. This was added, and it operated as a model and some hands were added.



Directory PATH of file output destination.

Default is 'PROJECT_ROOT/etc/FsaveDate'.


When the number of preservation directories under the control of 'base_path' exceeds this set value, it deletes it in old the order.

Default is '90'.


Extension in saved file.

Default is 'txt'.


It is a method of customizing the controller module generated in the helper script.

First of all, because the name space is a road as shown in model manager's @ISA, it customizes it in the subordinate's MyApp::Model::FsaveDate::handler though controller's package name is MyApp::Model::FsaveDate.

The configuration is set in this handler, and an existing if necessary method is Obarraided.

  package MyApp::Model::FsaveDate::handler;
  __PACKAGE__->config( .......... );

For instance, to convert the character-code of the preserved text into the arbitrary one, 'create_body' method is Orbaraided.

  sub create_body {
     my($self, $text)= @_;
     return Jcode->new($text)->sjis;

Passed $text is passed by the SCALAR reference. After this is processed, it returns it with usual SCALAR.

Additionally, there are 'create_dir_name' and 'create_file_name' in the method of possible override. Please refer to the source code for details for the processing method etc.


Egg::Release, Egg::Model::FsaveDate::Base, Egg::Helper::Model::FsaveDate,


Masatoshi Mizuno <>


Copyright (C) 2008 by Bee Flag, Corp. <>, All Rights Reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.