Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
631ae95
fork of App::p now includes modules for datastructure modification (D…
code-acrobat Feb 10, 2012
5f02b1a
Merge remote-tracking branch 'ironcamel/master'
code-acrobat Oct 26, 2012
4ba8482
Fresh sync with Ironcamel
Jan 28, 2022
1cc6784
Merge remote-tracking branch 'ironcamel/master'
Jan 28, 2022
9de9d4d
sync with ironcamel
Jan 28, 2022
7c53c90
Added dzil Run::AfterBuild command to keep Makefile.PL
Jan 28, 2022
f1f3dd8
ignore Dist::Zilla outputs
Jan 28, 2022
8012af6
Add renovate.json
renovate-bot Feb 7, 2025
e82fffa
Merge pull request #1 from code-acrobat/renovate/configure
code-acrobat Feb 7, 2025
f9e8b1a
converted dist.ini to cpanfile
code-acrobat Feb 7, 2025
f3ddd6c
add cpanfile manager
code-acrobat Feb 7, 2025
d1b8ece
fixup
code-acrobat Feb 7, 2025
d9a510c
full config
code-acrobat Feb 7, 2025
216fec1
regexManager -> packageManager
code-acrobat Feb 7, 2025
9d04d9d
remove duplicate
code-acrobat Feb 7, 2025
9f18af1
remove hallucinated setting
code-acrobat Feb 7, 2025
25e4d62
add snapshot file, remove prTitle
code-acrobat Feb 7, 2025
0072805
remove illegal config
code-acrobat Feb 7, 2025
24c0bb6
remove illegal config
code-acrobat Feb 7, 2025
83b3492
regex approach
code-acrobat Feb 7, 2025
109e0be
added gemini suggestion
code-acrobat Feb 7, 2025
1c28175
add dependency dashboard
code-acrobat Feb 7, 2025
99e8f36
downgrade to test
code-acrobat Feb 7, 2025
fa81c74
test versions
code-acrobat Feb 7, 2025
e86cffd
Update dependency utf8::all to v0.024
renovate-bot Feb 7, 2025
15dde7b
Merge pull request #3 from code-acrobat/renovate/utf8-all-0.x
code-acrobat Feb 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Makefile.PL
App-p-*
34 changes: 22 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
# About
# DESCRIPTION

Steroids for your perl one-liners. Is that even possible?
This module provides a script 'p', which has handy shortcuts for modules that are used in one-liners.

# Installation

sudo cpan App::p

# Documentation

See [App::p](https://metacpan.org/module/App::p)

# Usage
# SYNOPSIS

Usage: p [-lneE etc] 'code'
The code can make use of:
Expand All @@ -30,7 +22,7 @@ See [App::p](https://metacpan.org/module/App::p)
get,head,getprint,getstore,mirror from LWP::Simple
sum,first,min,max,zip,uniq,any,all,none ... all of List::AllUtils

# Examples
Examples:

p 'dd [File::Spec->path]' # dynamically load arbitrary modules
p -pe 's/foo/bar/' foo.txt # use your favorite options like -lane
Expand All @@ -40,5 +32,23 @@ See [App::p](https://metacpan.org/module/App::p)
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 flatten {foo=>{var=>2}}' # print {"foo.var" => 2}
p 'dd +{foo=>{var=>2}} ~~ dpath "//foo"' # dpath search for foo, prints [{var => 2}]
p 'p get "http://icanhazip.com"' # print contents of url
p 'p xj "file.xml" # (xj xml to json )print xml's equivalent json
p 'p jx "file.json" # (jx json to xml )print json's equivalent xml
p 'dd uniq map $_->{ostext}, @{ jl get "http://www.cpantesters.org/distro/A/App-p.json" }' # have fun!

# CONTRIBUTORS

- datamuc <[https://github.com/datamuc](https://github.com/datamuc)>
- Jenish Gnanasicamani <[https://github.com/JenishGnanasicamani](https://github.com/JenishGnanasicamani)>
- Stanislaw Pusep <[https://github.com/creaktive](https://github.com/creaktive)>
- Stefan Corneliu Petrea <[https://github.com/wsdookadr](https://github.com/wsdookadr)>
- Tommy Stanton <[https://github.com/tommystanton](https://github.com/tommystanton)>

# ACKNOWLEDGEMENTS

This is based on Randy Stauner's
[http://blogs.perl.org/users/randy\_stauner/2011/06/exploratory-one-liners-with-less-typing.html](http://blogs.perl.org/users/randy_stauner/2011/06/exploratory-one-liners-with-less-typing.html)
and Marco Fontani's [https://gist.github.com/1042504](https://gist.github.com/1042504).
25 changes: 21 additions & 4 deletions bin/p
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,23 @@ exec
'-M-warnings=deprecated',
'-ML',
'-MData::Dump=dd,dump',
'-MFile::Slurper',
(grep { /\b(?:xd|xl)\b/ } @ARGV)
? ('-MXML::Hash::LX')
: (),
'-MList::AllUtils=:all',
(grep { /\b(?:get(?:print|store)?|head|mirror)\b/x } @ARGV)
? ('-MLWP::Simple')
: (),
(grep { /\b(?:yl|yd)\b/ } @ARGV)
? ('-MYAML::XS')
: (),
(grep { /\bdpath\b/ } @ARGV)
? ('-MData::DPath=dpath')
: (),
(grep { /\bflatten\b/ } @ARGV)
? ('-MHash::Flatten=:all')
: (),
'-Mutf8::all',
'-E',
q[
Expand All @@ -30,8 +43,8 @@ exec
sub jl { JSON->new->utf8->allow_nonref->decode(shift) }
sub xd { print Encode::decode_utf8(XML::Hash::LX::hash2xml(shift)) }
sub xl { XML::Hash::LX::xml2hash(shift) }
sub yd { print Encode::decode_utf8(YAML::Dump(shift)) }
sub yl { YAML::Load(shift) }
sub yd { print Encode::decode_utf8(YAML::XS::Dump(shift)) }
sub yl { YAML::XS::Load(shift) }
sub xj { print JSON->new->utf8->pretty->encode(XML::Simple->new(keepRoot => 1)->XMLin(shift))}
sub jx { print XML::Simple->new(keepRoot => 1)->XMLout(JSON->new->utf8->allow_nonref->decode(scalar File::Slurper::read_text(shift)))}
], @ARGV;
Expand All @@ -53,12 +66,14 @@ exec
jl to JSON::decode (utf8/allow nonref) a thing
xd to XML::Hash::LX::hash2xml()
xl to XML::Hash::LX::xml2hash()
yd to YAML::Dump()
yl to YAML::Load()
yd to YAML::XS::Dump()
yl to YAML::XS::Load()
xj to convert an xml file to json
jx to convert a json file to xml
get,head,getprint,getstore,mirror from LWP::Simple
sum,first,min,max,zip,uniq,any,all,none ... all of List::AllUtils
flatten,unflatten of Hash::Flatten
dpath of Data::Dpath

Examples:

Expand All @@ -70,6 +85,8 @@ exec
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 flatten {foo=>{var=>2}}' # print {"foo.var" => 2}
p 'dd +{foo=>{var=>2}} ~~ dpath "//foo"' # dpath search for foo, prints [{var => 2}]
p 'p get "http://icanhazip.com"' # print contents of url
p 'p xj "file.xml" # (xj xml to json )print xml's equivalent json
p 'p jx "file.json" # (jx json to xml )print json's equivalent xml
Expand Down
14 changes: 14 additions & 0 deletions cpanfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
requires 'Data::Dump', '1.25';
requires 'File::Slurper';
requires 'JSON';
requires 'L';
requires 'LWP::Simple';
requires 'List::AllUtils';
requires 'Pod::Usage';
requires 'Scalar::Util';
requires 'YAML::XS';
requires 'utf8::all', '0.024';
requires 'XML::Simple';
requires 'XML::Hash::LX';
requires 'Data::DPath';
requires 'Hash::Flatten';
Loading