NAME
Egg::Plugin::BackUP::Easy - Preserve backup data for Egg plugin.
SYNOPSIS
use Egg qw/ Plugin::BackUP::Easy /;
configuration.
plugin_backup => {
base_path => '<$e.dir.tmp>/backup',
amount_save => 60,
extention => 'dat',
},
code.
my $save_data= '.......';
$e->backup(\$save_data);
DESCRIPTION
It is a plug-in that generates the directory every date, and saves data.
When the date that exceeds 'amount_save' directory exists, it is deleted from the old one by the automatic operation.
The file name is made by a certain specific rule and if it is generation, '_backup_create_fname' method is made for the controller.
The value of sha_hex generated from the content of data is used in default for the file name.
sub _backup_create_fname {
my($e, $body)= @_;
my $count= $e->get_count_data;
return sprintf "%06d", $count;
}
To correct the content of data when preserving it, '_backup_create_body' method is made for the controller.
It preserves it as it is in default.
sub _backup_create_body {
my($e, $body)= @_;
$$body=~s{(?:\r\n|\r|\n)} [\r\n]sg;
$e->sjis_conv($body);
}
CONFIGURATION
A configuration name is 'plugin_backup'.
base_path => [PATH]
Directory PATH preservation ahead.
There is no default. Please set it.
plugin_backup => {
...
base_path => '/path/to/backup',
},
amount_save => [NUMBER]
Number of date left under the control of 'base_path' directories.
Default is 90.
plugin_backup => {
...
amount_save => 120,
},
extention => [STRING]
Extension of preservation data.
Default is txt.
plugin_backup => {
...
extention => 'dat',
},
METHODS
backup ([DATA_VALUE_REF])
The called directory of the date is made under the control of 'base_path', and DATA_VALUE_REF is preserved by the file name generated with '_backup_create_fname' in that.
my $mailbody= '.....';
$e->mail->send( body => \$mailbody );
$e->backup( \$mailbody );
SEE ALSO
AUTHOR
Masatoshi Mizuno <lushe@cpan.org>
COPYRIGHT
Copyright (C) 2007 by Bee Flag, Corp. <http://egg.bomcity.com/>, 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.