… | |
… | |
32 | |
32 | |
33 | =over 4 |
33 | =over 4 |
34 | |
34 | |
35 | =item json - a json text encoded, either utf-8, utf16-be/le, utf32-be/le |
35 | =item json - a json text encoded, either utf-8, utf16-be/le, utf32-be/le |
36 | |
36 | |
|
|
37 | =item cbor - CBOR (RFC 7049, L<CBOR::XS>), a kind of binary JSON |
|
|
38 | |
37 | =item storable - a Storable frozen value |
39 | =item storable - a L<Storable> frozen value |
38 | |
40 | |
39 | =item storable-file - a Storable file (Storable has two incompatible formats) |
41 | =item storable-file - a L<Storable> file (Storable has two incompatible formats) |
40 | |
42 | |
41 | =item bencode - use Convert::Bencode, if available (used by torrent files, among others) |
43 | =item bencode - use L<Convert::Bencode>, if available (used by torrent files, among others) |
42 | |
44 | |
43 | =item clzf - Compress::LZF format (requires that module to be installed) |
45 | =item clzf - L<Compress::LZF> format (requires that module to be installed) |
44 | |
46 | |
45 | =item eval - evaluate the given code as (non-utf-8) Perl, basically the reverse of "-t dump" |
47 | =item eval - evaluate the given code as (non-utf-8) Perl, basically the reverse of "-t dump" |
46 | |
48 | |
47 | =item yaml - YAML (avoid at all costs, requires the YAML module :) |
49 | =item yaml - L<YAML> (avoid at all costs, requires the YAML module :) |
48 | |
50 | |
49 | =item string - do not attempt to decode the file data |
51 | =item string - do not attempt to decode the file data |
50 | |
52 | |
51 | =item none - nothing is read, creates an C<undef> scalar - mainly useful with C<-e> |
53 | =item none - nothing is read, creates an C<undef> scalar - mainly useful with C<-e> |
52 | |
54 | |
… | |
… | |
66 | |
68 | |
67 | =item json-utf-16le, json-utf-16be - little endian/big endian utf-16 |
69 | =item json-utf-16le, json-utf-16be - little endian/big endian utf-16 |
68 | |
70 | |
69 | =item json-utf-32le, json-utf-32be - little endian/big endian utf-32 |
71 | =item json-utf-32le, json-utf-32be - little endian/big endian utf-32 |
70 | |
72 | |
|
|
73 | =item cbor - CBOR (RFC 7049, L<CBOR::XS>), a kind of binary JSON |
|
|
74 | |
71 | =item storable - a Storable frozen value in network format |
75 | =item storable - a L<Storable> frozen value in network format |
72 | |
76 | |
73 | =item storable-file - a Storable file in network format (Storable has two incompatible formats) |
77 | =item storable-file - a L<Storable> file in network format (Storable has two incompatible formats) |
74 | |
78 | |
75 | =item bencode - use Convert::Bencode, if available (used by torrent files, among others) |
79 | =item bencode - use L<Convert::Bencode>, if available (used by torrent files, among others) |
76 | |
80 | |
77 | =item clzf - Compress::LZF format |
81 | =item clzf - L<Compress::LZF> format |
78 | |
82 | |
79 | =item yaml - YAML |
83 | =item yaml - L<YAML> |
80 | |
84 | |
81 | =item dump - Data::Dump |
85 | =item dump - L<Data::Dump> |
82 | |
86 | |
83 | =item dumper - Data::Dumper |
87 | =item dumper - L<Data::Dumper> |
84 | |
88 | |
85 | =item string - writes the data out as if it were a string |
89 | =item string - writes the data out as if it were a string |
86 | |
90 | |
87 | =item none - nothing gets written, mainly useful together with C<-e> |
91 | =item none - nothing gets written, mainly useful together with C<-e> |
88 | |
92 | |
… | |
… | |
171 | : /^.\x00.\x00/s ? "utf-16le" |
175 | : /^.\x00.\x00/s ? "utf-16le" |
172 | : "utf-8"; |
176 | : "utf-8"; |
173 | warn "input text encoding is $enc\n" if $opt_verbose; |
177 | warn "input text encoding is $enc\n" if $opt_verbose; |
174 | JSON::XS->new->decode (decode $enc, $_) |
178 | JSON::XS->new->decode (decode $enc, $_) |
175 | }, |
179 | }, |
|
|
180 | "cbor" => sub { require CBOR::XS; CBOR::XS::decode_cbor ($_) }, |
176 | "storable" => sub { Storable::thaw $_ }, |
181 | "storable" => sub { Storable::thaw $_ }, |
177 | "storable-file" => sub { open my $fh, "<", \$_; Storable::fd_retrieve $fh }, |
182 | "storable-file" => sub { open my $fh, "<", \$_; Storable::fd_retrieve $fh }, |
178 | "bencode" => sub { require Convert::Bencode; Convert::Bencode::bdecode ($_) }, |
183 | "bencode" => sub { require Convert::Bencode; Convert::Bencode::bdecode ($_) }, |
179 | "clzf" => sub { require Compress::LZF; Compress::LZF::sthaw ($_) }, |
184 | "clzf" => sub { require Compress::LZF; Compress::LZF::sthaw ($_) }, |
180 | "yaml" => sub { require YAML; YAML::Load ($_) }, |
185 | "yaml" => sub { require YAML; YAML::Load ($_) }, |
… | |
… | |
189 | "json-pretty" => sub { JSON::XS->new->utf8->pretty->encode ($_) }, |
194 | "json-pretty" => sub { JSON::XS->new->utf8->pretty->encode ($_) }, |
190 | "json-utf-16le" => sub { encode "utf-16le", JSON::XS->new->encode ($_) }, |
195 | "json-utf-16le" => sub { encode "utf-16le", JSON::XS->new->encode ($_) }, |
191 | "json-utf-16be" => sub { encode "utf-16be", JSON::XS->new->encode ($_) }, |
196 | "json-utf-16be" => sub { encode "utf-16be", JSON::XS->new->encode ($_) }, |
192 | "json-utf-32le" => sub { encode "utf-32le", JSON::XS->new->encode ($_) }, |
197 | "json-utf-32le" => sub { encode "utf-32le", JSON::XS->new->encode ($_) }, |
193 | "json-utf-32be" => sub { encode "utf-32be", JSON::XS->new->encode ($_) }, |
198 | "json-utf-32be" => sub { encode "utf-32be", JSON::XS->new->encode ($_) }, |
194 | |
199 | "cbor" => sub { require CBOR::XS; CBOR::XS::encode_cbor ($_) }, |
195 | "storable" => sub { Storable::nfreeze $_ }, |
200 | "storable" => sub { Storable::nfreeze $_ }, |
196 | "storable-file" => sub { open my $fh, ">", \my $buf; Storable::nstore_fd $_, $fh; $buf }, |
201 | "storable-file" => sub { open my $fh, ">", \my $buf; Storable::nstore_fd $_, $fh; $buf }, |
197 | |
|
|
198 | "bencode" => sub { require Convert::Bencode; Convert::Bencode::bencode ($_) }, |
202 | "bencode" => sub { require Convert::Bencode; Convert::Bencode::bencode ($_) }, |
199 | "clzf" => sub { require Compress::LZF; Compress::LZF::sfreeze_cr ($_) }, |
203 | "clzf" => sub { require Compress::LZF; Compress::LZF::sfreeze_cr ($_) }, |
200 | "yaml" => sub { require YAML; YAML::Dump ($_) }, |
204 | "yaml" => sub { require YAML; YAML::Dump ($_) }, |
201 | "dumper" => sub { |
205 | "dumper" => sub { |
202 | require Data::Dumper; |
206 | require Data::Dumper; |