App-DPath
view release on metacpan or search on metacpan
"Test::Pod" : "1.41",
"Test::Pod::Coverage" : "1.08"
}
},
"runtime" : {
"requires" : {
"App::Rad" : "0",
"Config::General" : "0",
"Config::INI::Serializer" : "0",
"Data::DPath" : "0",
"Data::Dumper" : "0",
"JSON" : "0",
"Scalar::Util" : "0",
"TAP::DOM" : "0",
"TAP::DOM::Archive" : "0",
"TAP::Parser" : "0",
"XML::Simple" : "0",
"YAML::Any" : "0",
"perl" : "5.008",
"strict" : "0",
"warnings" : "0"
name: App-DPath
provides:
App::DPath:
file: lib/App/DPath.pm
version: '0.12'
requires:
App::Rad: '0'
Config::General: '0'
Config::INI::Serializer: '0'
Data::DPath: '0'
Data::Dumper: '0'
JSON: '0'
Scalar::Util: '0'
TAP::DOM: '0'
TAP::DOM::Archive: '0'
TAP::Parser: '0'
XML::Simple: '0'
YAML::Any: '0'
perl: '5.008'
strict: '0'
warnings: '0'
Makefile.PL view on Meta::CPAN
"bin/dpath"
],
"LICENSE" => "perl",
"MIN_PERL_VERSION" => "5.008",
"NAME" => "App::DPath",
"PREREQ_PM" => {
"App::Rad" => 0,
"Config::General" => 0,
"Config::INI::Serializer" => 0,
"Data::DPath" => 0,
"Data::Dumper" => 0,
"JSON" => 0,
"Scalar::Util" => 0,
"TAP::DOM" => 0,
"TAP::DOM::Archive" => 0,
"TAP::Parser" => 0,
"XML::Simple" => 0,
"YAML::Any" => 0,
"strict" => 0,
"warnings" => 0
},
Makefile.PL view on Meta::CPAN
"TESTS" => "t/*.t"
}
);
my %FallbackPrereqs = (
"App::Rad" => 0,
"Config::General" => 0,
"Config::INI::Serializer" => 0,
"Data::DPath" => 0,
"Data::Dumper" => 0,
"Data::Structure::Util" => 0,
"File::Spec" => 0,
"IO::Handle" => 0,
"IPC::Open3" => 0,
"JSON" => 0,
"Scalar::Util" => 0,
"TAP::DOM" => 0,
"TAP::DOM::Archive" => 0,
"TAP::Parser" => 0,
"Test::Deep" => 0,
specified.
$ dpath '//some/dpath' data.yaml
Use it as filter:
$ dpath '//some/dpath' < data.yaml > result.yaml
$ cat data.yaml | dpath '//some/dpath' > result.yaml
$ cat data.yaml | dpath '//path1' | dpath '//path2' | dpath '//path3'
Specify that output is YAML(default), JSON or Data::Dumper:
$ dpath -o yaml '//some/dpath' data.yaml
$ dpath -o json '//some/dpath' data.yaml
$ dpath -o dumper '//some/dpath' data.yaml
Input is JSON:
$ dpath -i json '//some/dpath' data.json
Input is INI:
Input is TAP:
$ dpath -i tap '//some/dpath' data.tap
$ perl t/some_test.t | dpath -i tap '//tests_planned'
Input is TAP::Archive:
$ dpath -i taparchive '//tests_planned' tap.tgz
Input is JSON, Output is Data::Dumper:
$ dpath -i json -o dumper '//some/dpath' data.json
=head2 Input formats
The following B<input formats> are allowed, with their according
modules used to convert the input into a data structure:
yaml - YAML::Any (default; not using YAML::Syck)
json - JSON
xml - XML::Simple
ini - Config::INI::Serializer
dumper - Data::Dumper (including the leading $VAR1 variable assignment)
tap - TAP::DOM
tap - TAP::DOM::Archive
=head2 Output formats
The following B<output formats> are allowed:
yaml - YAML::Any (default; not using YAML::Syck)
json - JSON
xml - XML::Simple
ini - Config::INI::Serializer
dumper - Data::Dumper (including the leading $VAR1 variable assignment)
flat - pragmatic flat output for typical unixish cmdline usage
=head2 The 'flat' output format
The C<flat> output format is meant to support typical unixish command
line uses. It is not a strong serialization format but works well for
simple values nested max 2 levels.
Output looks like this:
lib/App/DPath.pm view on Meta::CPAN
my $json = JSON->new->allow_nonref->pretty->allow_blessed->convert_blessed;
$output .= $json->encode($resultlist);
}
elsif ($outtype eq "ini") {
require Config::INI::Serializer;
my $ini = Config::INI::Serializer->new;
$output .= $ini->serialize($resultlist);
}
elsif ($outtype eq "dumper")
{
require Data::Dumper;
$output .= Data::Dumper::Dumper($resultlist);
}
elsif ($outtype eq "xml")
{
require XML::Simple;
my $xs = new XML::Simple;
$output .= $xs->XMLout($resultlist, AttrIndent => 1, KeepRoot => 1);
}
elsif ($outtype eq "flat") {
$output .= _format_flat( $opt, $resultlist );
}
t/app_dpath.t view on Meta::CPAN
#! /usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
use Test::More;
use Test::Deep;
use JSON;
use YAML::Syck;
use Config::General;
use Config::INI::Serializer;
use Data::Structure::Util 'unbless';
sub check {
my ($intype, $outtype, $path, $expected, $just_diag) = @_;
#!/usr/bin/env perl
#
# Here we test the subroutines in the App::Dpath module in relative
# isolation.
#
################################################################################
use strict;
use warnings;
use Data::Dumper;
use Test::More tests => 74;
BEGIN { use_ok 'App::DPath'; }
my $opt;
is App::DPath::_format_flat_inner_scalar ('a'), 'a',
'_format_flat_inner_scalar scalar';
is App::DPath::_format_flat_inner_scalar (''), '',
'_format_flat_inner_scalar empty';
is App::DPath::_format_flat_inner_scalar (undef), '',
t/taparchive.t view on Meta::CPAN
#! /usr/bin/env perl
use strict;
use warnings;
use Test::More 0.88;
use Data::Dumper;
my $program = "$^X -Ilib bin/dpath";
my $infile = "t/testdata.taparchive";
my $dumper = `$program -i taparchive -o dumper / $infile`;
my $VAR1;
eval $dumper;
#diag Dumper($VAR1->[0]);
( run in 0.310 second using v1.01-cache-2.11-cpan-4d50c553e7e )