1App::p(3) User Contributed Perl Documentation App::p(3)
2
3
4
6 App::p - Steroids for your perl one-liners.
7
9 version 0.0400
10
12 Usage: p [-lneE etc] 'code'
13 The code can make use of:
14 r to File::Slurper::read_text()
15 w to File::Slurper::write_file()
16 S to say()
17 p to print()
18 dd to Data::Dump::dd()
19 jd to JSON::encode (utf8/pretty)
20 jl to JSON::decode (utf8/allow nonref) a thing
21 xd to XML::Hash::LX::hash2xml()
22 xl to XML::Hash::LX::xml2hash()
23 yd to YAML::Dump()
24 yl to YAML::Load()
25 xj to convert an xml file to json
26 jx to convert a json file to xml
27 get,head,getprint,getstore,mirror from LWP::Simple
28 sum,first,min,max,zip,uniq,any,all,none ... all of List::AllUtils
29
30 Examples:
31
32 p 'dd [File::Spec->path]' # dynamically load arbitrary modules
33 p -pe 's/foo/bar/' foo.txt # use your favorite options like -lane
34 p 'say "hello world!"' # -E is assumed if no options are provided
35 p 'dd yl r "config.yml"' # chain commands
36 p 'S sum 1,2,3,4' # all of List::AllUtils is at your fingertips
37 p 'dd ExtUtils::Installed->new->modules' # list all installed modules
38 p ' dd xl r "/etc/xml/xml-core.xml"' # print dump of hash converted xml
39 p 'p xd xl r "/etc/xml/xml-core.xml"' # print xml converted from hash
40 p 'p get "http://icanhazip.com"' # print contents of url
41 p 'p xj "file.xml" # (xj xml to json )print xml's equivalent json
42 p 'p jx "file.json" # (jx json to xml )print json's equivalent xml
43 p 'dd uniq map $_->{ostext}, @{ jl get "http://www.cpantesters.org/distro/A/App-p.json" }' # have fun!
44
46 · datamuc <<https://github.com/datamuc>>
47
48 · Jenish Gnanasicamani <<https://github.com/JenishGnanasicamani>>
49
50 · Stanislaw Pusep <<https://github.com/creaktive>>
51
52 · Stefan Corneliu Petrea <<https://github.com/wsdookadr>>
53
54 · Tommy Stanton <<https://github.com/tommystanton>>
55
57 This is based on Randy Stauner's
58 <http://blogs.perl.org/users/randy_stauner/2011/06/exploratory-one-liners-with-less-typing.html>
59 and Marco Fontani's <https://gist.github.com/1042504>.
60
62 Naveed Massjouni <naveed@vt.edu>
63
65 This software is copyright (c) 2011 by Naveed Massjouni.
66
67 This is free software; you can redistribute it and/or modify it under
68 the same terms as the Perl 5 programming language system itself.
69
70
71
72perl v5.30.0 2019-07-26 App::p(3)