Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Announcing "p5u"

by tobyink (Abbot)
on Jul 02, 2012 at 21:13 UTC ( #979538=perlmeditation: print w/replies, xml ) Need Help??

In the thread CPAN Testers command-line viewer, it was suggested I release the script on CPAN. Well, now it's on CPAN, but not as a standalone script - it's part of p5u.

p5u is a command-line script which acts as a single point of entry for several different Perl and CPAN related utilities. The cool thing about p5u is that it's pluggable, so you can write your own P5U commands for local use, or publish them on CPAN. (A template command module is provided.)

Here's some examples of what can be done with p5u...

Hmmm... what version of the HTML::HTML5::Entities module is installed?

$ p5u version HTML::HTML5::Entities HTML::HTML5::Entities /opt/perl-5.16.0/lib/site_perl/5.16.0/HTML/HTML5/ 0.0 +03

How is that version doing on CPAN Testers?

$ p5u testers HTML::HTML5::Entities CPAN Testers results for HTML-HTML5-Entities version 0.003 PASS FAIL ETC Perl 5.006 0 0 1 Perl 5.008 6 0 0 Perl 5.010 18 0 0 Perl 5.012 40 0 0 Perl 5.014 24 0 0 Perl 5.016 9 0 0 Perl 5.017 6 0 0

Let's run the HTML-HTML5-Entities test suite against my currently installed copy of the module

$ p5u reprove HTML::HTML5::Entities Reproving HTML-HTML5-Entities/0.003 (TOBYINK) t/01basic.t ..... ok t/02encoding.t .. ok t/03decoding.t .. ok All tests successful. Files=3, Tests=16, 1 wallclock secs ( 0.14 usr 0.02 sys + 0.65 cusr 0.02 csys = 0.83 CPU) Result: PASS
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.
Re: Announcing "p5u"
by toolic (Bishop) on Jul 02, 2012 at 21:32 UTC
    The p5u script has a compile error for me:
    $ perl -c p5u Type of arg 1 to unshift must be array (not scalar dereference) at p5u + line 7, near "@ARGV if" p5u had compilation errors. $ $ perl -v This is perl 5, version 12, subversion 2 (v5.12.2) built for x86_64-li +nux

    Is there something I need to do, or should it just run out of the box? P5U seemed to install properly.

      The line is:

      unshift $1, @ARGV if basename($0) =~ /^p5u-(\w+)$/;

      ... which is clearly an error. In 5.14, with push et all able to dereference scalar references, this is merely a symbolic reference.

        Hmmm... yes, the arguments to unshift need to be swapped. :-( Autoderef is fast shaping up to be my most unfavourite new Perl feature as it stops recent Perls from detecting this at the compile stage.

        update: 0.003 has now been uploaded; it should address this issue.

        perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
Re: Announcing "p5u"
by mje (Curate) on Jul 03, 2012 at 12:34 UTC

    I think I may find this useful - thanks. Can you give an example of debian-release as I could only get it to work for you and your modules:

    $ p5u debian-release DBI PACKAGE CPAN DEBIAN + WARNING DBI 1.622 (none) + !! $ p5u debian-release -a timb PACKAGE CPAN DEBIAN + WARNING $ p5u debian-release -a tobyink PACKAGE CPAN DEBIAN + WARNING HTML-Data-Parser 0.006 0.005-1 + !! . .

    and what is the warning?

      I get the same result as you for DBI and timb. However, these all work:

      • p5u dr -a adamk
      • p5u dr -a flora
      • p5u dr MooseX-Declare
      • p5u dr JSON

      There may be something specific to Tim Bunce happening. I'll have to investigate further.

      The warning is either "!!" or blank. When it's "!!" it means that Debian's package is not up to date. Yes, this probably wants to be documented. (And also the warning probably shouldn't be shown when the Debian version is "(none)".)

      Update: aha! It looks like the regular expression I was using to parse the Debian package list is at fault. /^(lib\S+?-perl) \((\S+?)\)/ should be /^(lib\S+?-perl) \((\S+).*\)/. 0.004 will be released soon.

      perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

        I just used DBI and timb as an example. I actually tried loads of modules and cpan users which didn't seem to produce any results e.g., DBIx-Log4perl, DBD-ODBC, mjevans which are the obvious ones (me) but as you say some work e.g., DBD-Oracle.

        I also sometimes get failures:

        $ p5u testers DBD::ODBC Failed to retrieve URI +on martin@bragi:~$ p5u testers DBD::ODBC CPAN Testers results for DBD-ODBC version 1.38_3 PASS FAIL ETC Perl 5.012 4 0 0 Perl 5.014 2 0 0

        but they could be something here so I will look into that.

        0.004 fixed the problem I found - thanks for the update.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://979538]
Approved by toolic
Front-paged by davido
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2017-11-25 08:16 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (355 votes). Check out past polls.