View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Joe McMahon > Test-Tail-Multi-0.03 > Test::Tail::Multi



Annotate this POD

View/Report Bugs
Module Version: 0.03   Source   Latest Release: Test-Tail-Multi-0.06


Test::Tail::Multi - execute code, monitor dynamic file contents


  use Test::Tail::Multi files => [qw(file1 file2)] tests=>2;
  # Can add files dynamically as well
  add_file('file3', "decided to add file3 too");

  # Execute a command and check against output
  contents_like {system('my_command -my_args")}   # Note no trailing comma!
                qr/expected value/,
                "got the expected output");

  # if code to execute is undef, check against previously captured new content
  contents_unlike undef,                          # trailing command REQUIRED
                  qr/unexpected text/,
                  "unexpected stuff not found in same text");

  # Shorten the delay to 1 second.
  delay(1, "Now a 1 second delay");
  contents_like(sub {system('fast_command')},     # trailing comma in parens
                "this command runs faster");


Test::Tail::Multi allows you to create tests or test classes that permit you to monitor the contents of one or more files a la <tail -f> using the nice File::Tail module. You can execute arbitrary code and then run tests versus the new content in the files.

If you choose, you can run multiple tests against the same content by passing undef as the code to be executed; Test::Tail::Multi will then reuse the contents it last extracted.

You can also adjust the delay time to be used to allow the code you called to "settle down" before checking the tails.

Test::Tail::Multi comes in handy for those testing jobs that require you to monitor several files at once to see what's happening in each one.



Adds another file to the list of files to be tailed.


Executes code and then looks through the lines just generated to see if that text appears. If the code to execute is undef, then the last set of lines generated is checked again.


Works the same as contents_like, except the sense of the test is reversed, succeeding if the pattern supplied does not match.


The amount of time Test::Tail::Multi waits for output to be generated before testing. Allows you to tune your test speed to match the expected running time of your code. Useful in detecting timeout situations (output should have been generated after 10 seconds, but wasn't).


Joe McMahon, <>


Copyright (C) 2005 by Joe McMahon and Yahoo!

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: