… | |
… | |
100 | =cut |
100 | =cut |
101 | |
101 | |
102 | use strict; |
102 | use strict; |
103 | |
103 | |
104 | use Getopt::Long; |
104 | use Getopt::Long; |
105 | use Storable; |
105 | use Storable (); |
106 | use Encode; |
106 | use Encode; |
107 | |
107 | |
108 | use JSON::XS; |
108 | use JSON::XS; |
109 | |
109 | |
110 | my $opt_verbose; |
110 | my $opt_verbose; |
… | |
… | |
128 | : /^.\x00.\x00/s ? "utf-16le" |
128 | : /^.\x00.\x00/s ? "utf-16le" |
129 | : "utf-8"; |
129 | : "utf-8"; |
130 | warn "input text encoding is $enc\n" if $opt_verbose; |
130 | warn "input text encoding is $enc\n" if $opt_verbose; |
131 | JSON::XS->new->decode (decode $enc, $_) |
131 | JSON::XS->new->decode (decode $enc, $_) |
132 | }, |
132 | }, |
133 | "storable" => sub { thaw $_ }, |
133 | "storable" => sub { Storable::thaw $_ }, |
134 | "storable-file" => sub { open my $fh, "<", \$_; Storable::fd_retrieve $fh }, |
134 | "storable-file" => sub { open my $fh, "<", \$_; Storable::fd_retrieve $fh }, |
135 | "clzf" => sub { require Compress::LZF; Compress::LZF::sthaw ($_) }, |
135 | "clzf" => sub { require Compress::LZF; Compress::LZF::sthaw ($_) }, |
136 | "yaml" => sub { require YAML; YAML::Load ($_) }, |
136 | "yaml" => sub { require YAML; YAML::Load ($_) }, |
137 | ); |
137 | ); |
138 | |
138 | |