Skip to content
Browse files

Code cleanup + getting ready to release v0.0304

  • Loading branch information...
1 parent b0d2b9d commit f87e751c9e0be30fd72eaec2f3cf55079f5c79a1 @ironcamel committed
Showing with 74 additions and 17 deletions.
  1. +4 −0 Changes
  2. +1 −0 README.md
  3. +43 −14 bin/p
  4. +1 −1 dist.ini
  5. +25 −2 lib/App/p.pm
View
4 Changes
@@ -1,5 +1,9 @@
Revision history for App-p
+0.0304 2013-02-10
+ Fixed unicode issues for jd, xd, and yd.
+ Thanks Stanislaw Pusep! (https://github.com/creaktive)
+
0.0303 2012-12-28
Made a huge performance boost to improve startup time. Modules such as
File::Slurp, JSON, YAML and LWP are only loaded if needed.
View
1 README.md
@@ -39,3 +39,4 @@ See [App::p](https://metacpan.org/module/App::p)
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 'p get "http://icanhazip.com"' # print contents of url
+ p 'dd uniq map $_->{ostext}, @{ jl get "http://www.cpantesters.org/distro/A/App-p.json" }' # have fun!
View
57 bin/p
@@ -14,25 +14,25 @@ exec
'-Mwarnings=all',
'-M-warnings=deprecated',
'-ML',
- '-MData::Dump',
+ '-MData::Dump=dd,dump',
'-MList::AllUtils=:all',
(grep { /\b(?:get(?:print|store)?|head|mirror)\b/x } @ARGV)
? ('-MLWP::Simple')
: (),
'-Mutf8::all',
'-E',
- q[BEGIN {
+ q[
sub r { scalar File::Slurp::read_file(shift) }
- sub w { File::Slurp::write_file(@_) }
- sub S { say @_ ? @_ : $_ }
- sub p { print @_ ? @_ : $_ }
- sub yd { print Encode::decode_utf8(YAML::XS::Dump(shift)) }
- sub yl { YAML::XS::Load(shift) }
- sub xd { print Encode::decode_utf8(XML::Hash::LX::hash2xml(shift)) }
- sub xl { XML::Hash::LX::xml2hash(shift) }
- sub jd { print Encode::decode_utf8(JSON::XS->new->utf8->pretty->encode(shift)) }
- sub jl { JSON::XS->new->utf8->allow_nonref->decode(shift) }
- }], @ARGV;
+ sub w { File::Slurp::write_file(@_) }
+ sub S { say @_ ? @_ : $_ }
+ sub p { print @_ ? @_ : $_ }
+ sub jd { print Encode::decode_utf8(JSON::XS->new->utf8->pretty->encode(shift)) }
+ sub jl { JSON::XS->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::XS::Dump(shift)) }
+ sub yl { YAML::XS::Load(shift) }
+ ], @ARGV;
# PODNAME: p
@@ -42,8 +42,8 @@ exec
Usage: p [-lneE etc] 'code'
The code can make use of:
- r to File::Slurp::read_file
- w to File::Slurp::write_file
+ r to File::Slurp::read_file()
+ w to File::Slurp::write_file()
S to say()
p to print()
dd to Data::Dump::dd()
@@ -67,5 +67,34 @@ exec
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 'p get "http://icanhazip.com"' # print contents of url
+ p 'dd uniq map $_->{ostext}, @{ jl get "http://www.cpantesters.org/distro/A/App-p.json" }' # have fun!
+
+=head1 CONTRIBUTORS
+
+=over 4
+
+=item *
+
+datamuc <L<https://github.com/datamuc>>
+
+=item *
+
+Stanislaw Pusep <L<https://github.com/creaktive>>
+
+=item *
+
+Stefan Corneliu Petrea <L<https://github.com/wsdookadr>>
+
+=item *
+
+Tommy Stanton <L<https://github.com/tommystanton>>
+
+=back
+
+=head1 ACKNOWLEDGEMENTS
+
+This is based on Randy Stauner's
+L<http://blogs.perl.org/users/randy_stauner/2011/06/exploratory-one-liners-with-less-typing.html>
+and Marco Fontani's L<https://gist.github.com/1042504>.
=cut
View
2 dist.ini
@@ -4,7 +4,7 @@ license = Perl_5
copyright_holder = Naveed Massjouni
copyright_year = 2011
-version = 0.0303
+version = 0.0304
[Prereqs]
Data::Dump = 0
View
27 lib/App/p.pm
@@ -10,8 +10,8 @@ package App::p;
Usage: p [-lneE etc] 'code'
The code can make use of:
- r to File::Slurp::read_file
- w to File::Slurp::write_file
+ r to File::Slurp::read_file()
+ w to File::Slurp::write_file()
S to say()
p to print()
dd to Data::Dump::dd()
@@ -35,6 +35,29 @@ package App::p;
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 'p get "http://icanhazip.com"' # print contents of url
+ p 'dd uniq map $_->{ostext}, @{ jl get "http://www.cpantesters.org/distro/A/App-p.json" }' # have fun!
+
+=head1 CONTRIBUTORS
+
+=over 4
+
+=item *
+
+datamuc <L<https://github.com/datamuc>>
+
+=item *
+
+Stanislaw Pusep <L<https://github.com/creaktive>>
+
+=item *
+
+Stefan Corneliu Petrea <L<https://github.com/wsdookadr>>
+
+=item *
+
+Tommy Stanton <L<https://github.com/tommystanton>>
+
+=back
=head1 ACKNOWLEDGEMENTS

0 comments on commit f87e751

Please sign in to comment.
Something went wrong with that request. Please try again.