Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

This does the trick. Usage notes at end.

use 5.010; use autodie; use common::sense; use MooseX::Declare; BEGIN { $CPAN::Retest::AUTHORITY = 'cpan:TOBYINK'; $CPAN::Retest::VERSION = '0.001'; } class CPAN::Retest { use App::Prove qw//; use File::Basename qw/fileparse/; use File::pushd qw/pushd/; use File::Path qw/make_path/; use File::Spec qw//; use File::Temp qw//; use LWP::Simple qw/get/; use Module::Manifest qw//; use Object::AUTHORITY qw/AUTHORITY/; has author => (is => 'ro', isa => 'Str', required => 1); has release => (is => 'ro', isa => 'Str', required => 1); has manifest => (is => 'rw', isa => 'ArrayRef[Str]', lazy => 1, b +uilder => '_build_manifest'); has testdir => (is => 'ro', isa => 'File::Temp::Dir', lazy => 1, + builder => '_build_testdir'); has verbose => (is => 'ro'); method url_for ($file) { sprintf( 'http://api.metacpan.org/source/%s/%s/%s', uc $self->author, $self->release, $file ); } method test_files { grep { m{^t/} } @{ $self->manifest }; } method _build_manifest { my $fh = File::Temp->new; binmode( $fh, ":utf8"); print $fh get($self->url_for('MANIFEST')); close $fh; my $manifest = Module::Manifest->new; $manifest->open(manifest => $fh->filename); return [ $manifest->files ]; } method _build_testdir { my $testdir = File::Temp->newdir; foreach my $file ($self->test_files) { my $dest = File::Spec->catfile($testdir->dirname, $file); my (undef, $d, undef) = fileparse($dest); make_path($d); open my $fh, '>', $dest; print $fh get($self->url_for($file)); close $fh; } return $testdir; } method run { my $chdir = pushd($self->testdir->dirname); my $app = App::Prove->new; $app->process_args('t'); $app->verbose(1) if $self->verbose; $app->run; } }

Usage:

my $test = CPAN::Retest->new( author => 'TOBYINK', release => 'Object-AUTHORITY-0.003', verbose => 1, ); $test->run;

Update:

This is now available on CPAN: App-Reprove-0.001.


In reply to Re: How to retain a CPAN module's unit tests and run them later. by tobyink
in thread How to retain a CPAN module's unit tests and run them later. by chrestomanci

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chilling in the Monastery: (13)
    As of 2014-09-02 13:41 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite cookbook is:










      Results (22 votes), past polls