in reply to Test::Warn, 'use' vs 'require'

You need to load Test::Warn before perl compiles the warning_like() statements, because that function has a prototype. The easiest way may be to set a flag.

my $have_test_warn = 0; BEGIN { eval { require Test::Warn; Test::Warn->import(); $have_test_warn = 1; }; }

Then test for $have_test_warn in your SKIP blocks.

Replies are listed 'Best First'.
Re^2: Test::Warn, 'use' vs 'require'
by Joost (Canon) on Sep 27, 2006 at 23:49 UTC

      Make that:

      &warning_li­ke( sub { warn "warning!" }, qr(warning­), 'basic warning' +);

      (note the &) so it will work even if the prototype gets loaded soon enough.

      Update: Ah, yes, & prototypes don't have this problem like some other prototypes do.

      - tye        

        (note the &) so it will work even if the prototype gets loaded soon enough.

        Actually in this instance you don't need the & since the bracketed version is legal code with or without prototypes - so either will work.