in reply to Re: Passing Dynamic Value to Test::More tests
in thread Passing Dynamic Value to Test::More tests

This node falls below the community's minimum standard of quality and will not be displayed.
  • Comment on Re^2: Passing Dynamic Value to Test::More tests

Replies are listed 'Best First'.
Re^3: Passing Dynamic Value to Test::More tests
by xdg (Monsignor) on Jan 19, 2006 at 05:08 UTC

    Are you using my in there? That part has to be outside the BEGIN block.

    my $test_count; BEGIN { $test_count = 2 } use Test::More tests => $test_count;

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re^3: Passing Dynamic Value to Test::More tests
by Madcap Laughs (Acolyte) on Jan 19, 2006 at 05:19 UTC
    Works for me:
    use warnings; BEGIN {$test_count = 2} use Test::More tests => $test_count; ok(1); ok(3);
    Outputs:

    1..2
    ok 1
    ok 2

    Cheers,
    Rob