Subject: | Integrate Data::DPath to App::p |
p is a cool tool to extract and transform data with minimum typing
effort. What is missing is a way to filter data.
I suggest to add Data::DPath support in p
Here is an example.
p ' dd ((xl r "/etc/xml/xml-core.xml") ~~ dpath "//catalog" )'
And a patch to make it happen.
--- /usr/bin/p 2012-09-14 16:34:41.296875000 +0200
+++ /usr/local/bin/p 2012-09-14 16:50:17.125000000 +0200
@@ -10,6 +10,7 @@
exec
'perl',
'-Mwarnings',
+ '-MData::DPath=dpath',
'-MClass::Autouse=:superloader',
'-MData::Dump',
'-MFile::Slurp',
@@ -77,6 +78,7 @@
p 'dd ExtUtils::Installed->new->modules' # list all installed modules
p ' dd xl r "/etc/xml/xml-core.xml"' # print dump of hash
converted xml
p 'p xd xl r "/etc/xml/xml-core.xml"' # print xml converted from
hash
+ p 'dd [{foo=>1},0,2] ~~ dpath "//foo"' # print Data::DPath
extract //foo
p 'p get "http://icanhazip.com"' # print contents of url
=head1 AUTHOR