http://qs1969.pair.com?node_id=524202


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

That's a great point. I use that pattern also for when I may want to skip a test file entirely if a test dependency isn't available.

use Test::More; eval { require Some::Crazy::Dependency }; if ($@) { plan skip_all => "Some::Crazy::Dependency not available"; } else { plan tests => 42; }

It could be done in a BEGIN block, too, but I find it more readable without them.

-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.