… | |
… | |
49 | =item yaml - L<YAML> (avoid at all costs, requires the YAML module :) |
49 | =item yaml - L<YAML> (avoid at all costs, requires the YAML module :) |
50 | |
50 | |
51 | =item string - do not attempt to decode the file data |
51 | =item string - do not attempt to decode the file data |
52 | |
52 | |
53 | =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> |
54 | |
|
|
55 | =item cbor - CBOR (via CBOR::XS) |
|
|
56 | |
54 | |
57 | =back |
55 | =back |
58 | |
56 | |
59 | =item -t toformat |
57 | =item -t toformat |
60 | |
58 | |
… | |
… | |
177 | : /^.\x00.\x00/s ? "utf-16le" |
175 | : /^.\x00.\x00/s ? "utf-16le" |
178 | : "utf-8"; |
176 | : "utf-8"; |
179 | warn "input text encoding is $enc\n" if $opt_verbose; |
177 | warn "input text encoding is $enc\n" if $opt_verbose; |
180 | JSON::XS->new->decode (decode $enc, $_) |
178 | JSON::XS->new->decode (decode $enc, $_) |
181 | }, |
179 | }, |
182 | "cbor" => sub { require CBOR::XS; CBOR::XS::decode_cbor ($_) }, |
180 | "cbor" => sub { require CBOR::XS; CBOR::XS->new->allow_cycles->decode ($_) }, |
183 | "storable" => sub { Storable::thaw $_ }, |
181 | "storable" => sub { Storable::thaw $_ }, |
184 | "storable-file" => sub { open my $fh, "<", \$_; Storable::fd_retrieve $fh }, |
182 | "storable-file" => sub { open my $fh, "<", \$_; Storable::fd_retrieve $fh }, |
185 | "bencode" => sub { require Convert::Bencode; Convert::Bencode::bdecode ($_) }, |
183 | "bencode" => sub { require Convert::Bencode; Convert::Bencode::bdecode ($_) }, |
186 | "clzf" => sub { require Compress::LZF; Compress::LZF::sthaw ($_) }, |
184 | "clzf" => sub { require Compress::LZF; Compress::LZF::sthaw ($_) }, |
187 | "yaml" => sub { require YAML; YAML::Load ($_) }, |
185 | "yaml" => sub { require YAML; YAML::Load ($_) }, |
188 | "cbor" => sub { require CBOR::XS; CBOR::XS::decode_cbor ($_) }, |
|
|
189 | "eval" => sub { my $v = eval "no strict; no warnings; no utf8;\n#line 1 \"input\"\n$_"; die "$@" if $@; $v }, |
186 | "eval" => sub { my $v = eval "no strict; no warnings; no utf8;\n#line 1 \"input\"\n$_"; die "$@" if $@; $v }, |
190 | ); |
187 | ); |
191 | |
188 | |
192 | my %T = ( |
189 | my %T = ( |
193 | "none" => sub { "" }, |
190 | "none" => sub { "" }, |