Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
I have this sitting in my ~/bin
#! /usr/bin/perl -w # onchange file ... command # run command if any of the given files/directories # change use strict; use warnings; use File::Find; use Digest::MD5; my $Command = pop @ARGV; my $Files = [@ARGV]; my $Last_digest = ''; sub has_changed { my $files = shift; my $ctx = Digest::MD5->new; find(sub {$ctx->add($File::Find::name, (stat($_))[9])}, grep { +-e $_} @$files); my $digest = $ctx->digest; my $has_changed = $digest ne $Last_digest; $Last_digest = $digest; return($has_changed); }; while (1) { system($Command) if has_changed($Files); sleep 1; };

I have this in my .cshrc

alias testwatch "onchange Makefile.PL Makefile */*.pod */*.pm *.pm t t +est.pl 'clear; make test \!*'"

I then type % testwatch or % testwatch TEST_VERBOSE=1 in the root directory of any module I'm messing with. This won't work 100% of the time but hits that 80/20 spot for me.

I have a little todo list on an improved test monitor that I will, when some of that mythical free time comes along, implement. Now we have the lovely Test::Harness::Straps it's not even that difficult.


In reply to Watching tests... by adrianh
in thread What goes in a test suite? by Marza

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 lurking in the Monastery: (7)
    As of 2014-10-23 02:25 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (123 votes), past polls