Thanks for this example. I have run your code with the printf uncommented and reproduced your findings (on Linux) but only on some runs. The result is inconsistent. Here is the output from 2 runs within a few seconds of each other:
10045 $ perl -MTAP::Harness -e '$h = TAP::Harness->new(); $h->runtests
+("./11138492.pl");'
./11138492.pl .. ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.06 usr 0.00 sys + 0.04 cusr
+ 0.00 csys = 0.10 CPU)
Result: PASS
10046 $ perl -MTAP::Harness -e '$h = TAP::Harness->new(); $h->runtests
+("./11138492.pl");'
./11138492.pl .. All 1 subtests passed
Test Summary Report
-------------------
./11138492.pl (Wstat: 0 Tests: 1 Failed: 0)
Parse errors: No plan found in TAP output
Files=1, Tests=1, 0 wallclock secs ( 0.06 usr 0.01 sys + 0.04 cusr
+ 0.00 csys = 0.11 CPU)
Result: FAIL
However, upon inspection the problem is not with TAP::Harness. The output of just running the script shows that the plan can appear in the middle of your data. Again, running a few times gives:
10046 $ perl 11138492.pl | grep -Fn 1..1
830:# 79678951..1
10047 $ perl 11138492.pl | grep -Fn 1..1
830:# 691..1
10047 $ perl 11138492.pl | grep -Fn 1..1
829:# 5056771..1
So this looks to be a buffering issue. If I simply modify your code to include $|++; before the plan is printed then the script runs fine, the plan is printed at the top and the test harness has no complaints.
Not a bug in Test::Harness after all.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.