« blib/lib/App/Asciio/setup/import_export/ascii.pl
↑ Summary
blib/lib/App/Asciio/stripes/center_connect_box.pm »
| 1 | |||
| 2 | use strict ; | ||
| 3 | use warnings ; | ||
| 4 | use File::Slurp ; | ||
| 5 | |||
| 6 | #---------------------------------------------------------------------------------------------------------------------------- | ||
| 7 | |||
| 8 | register_import_export_handlers | ||
| 9 | ( | ||
| 10 | asciioe => | ||
| 11 | { | ||
| 12 | IMPORT => \&import_asciioe, | ||
| 13 | EXPORT => \&export_asciioe, | ||
| 14 | }, | ||
| 15 | ) ; | ||
| 16 | |||
| 17 | #---------------------------------------------------------------------------------------------------------------------------- | ||
| 18 | |||
| 19 | sub import_asciioe | ||
| 20 | { | ||
| 21 | my ($self, $file) = @_ ; | ||
| 22 | |||
| 23 | my $self_to_resurect= do $file or die "import_asciioe: can't load file '$file': $! $@\n" ; | ||
| 24 | return($self_to_resurect, $file) ; | ||
| 25 | } | ||
| 26 | |||
| 27 | #---------------------------------------------------------------------------------------------------------------------------- | ||
| 28 | |||
| 29 | sub export_asciioe | ||
| 30 | { | ||
| 31 | my ($self, $elements_to_save, $file, $data) = @_ ; | ||
| 32 | |||
| 33 | if($self->{CREATE_BACKUP} && -e $file) | ||
| 34 | { | ||
| 35 | use File::Copy; | ||
| 36 | copy($file,"$file.bak") or die "export_pod: Copy failed while making backup copy: $!" ; | ||
| 37 | } | ||
| 38 | |||
| 39 | my $saved = write_file($file, {binmode => ':utf8'}, $self->serialize_self(1) .'$VAR1 ;') ; | ||
| 40 | |||
| 41 | return $saved ; | ||
| 42 | } | ||
| 43 | |||
| 44 |