I am seeing some unexpected behavior in my Test::Base::Filters. Here is an expample for duplication: In MyTest.pm:
package t::MyTest; use Test::Base -Base; #some stuff here package t::MyTest::Filter; use base 'Test::Base::Filter'; sub choose { print @_; return {foo => 'bar'} if($_[0] eq '1'); return undef; } sub is_defined{ print @_; defined $_[0]; }
And in test.t:
use t::MyTest; filters {input => [qw(choose is_defined)] }; __END__ === First --- input 1 --- expected: 1 === Second --- input 0 --- expected: 0
What I expect is for the two filters to chain, the output of parse becoming the input to is_defined. Place both of the files in in a "t" folder and run "prove -v", and this is the output:
t\01-test.t .. Use of uninitialized value $_[1] in print at t/MyTest.p +m line 14, <DATA> line 1. 1 t::MyTest::Filter=HASH(0x2af1670)ok 1 - First 1..1 Failed 1/1 subtests Test Summary Report ------------------- t\01-test.t (Wstat: 0 Tests: 0 Failed: 0) Parse errors: Bad plan. You planned 1 tests but ran 0. Files=1, Tests=0, 1 wallclock secs ( 0.06 usr + 0.23 sys = 0.30 CPU +) Result: FAIL
Nevermind the warning, which I don't understand the root of. Why is the input to the first filter the actual input, and the input to the second filter some filter object? I'm also uncertain why only one test was run, instead of the two I expected.

In reply to Test::Base::Filter woes by nglenn

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.