Hello!
I released now Test::Warn 0.05 in CPAN and I decided me to give this interface:
use Test::Warn;
warning_is {foo(-dri => "/")} "Unknown Parameter 'dri'", "dri != dir gives
warning";
warnings_are {bar(1,1)} ["Width very small", "Height very small"];
warning_is {add(2,2)} undef, "No warning to calc 2+2"; # or
warnings_are {add(2,2)} [], "No warning to calc 2+2"; # what reads better :-)
warning_like {foo(-dri => "/"} qr/unknown param/i, "an unknown parameter test";
warnings_like {bar(1,1)} [qr/width.*small/i, qr/height.*small/i];
warning_is {foo()} {carped => 'didn't found the right parameters'};
warnings_like {foo()} [qr/undefined/,qr/undefined/,{carped => qr/no result/i}];
warning_like {foo(undef)} 'uninitialized';
warning_like {bar(file => '/etc/passwd')} 'io';
warning_like {eval q/"$x"; $x;/}
[qw/void uninitialized/],
"some warnings at compile time";
Greetings,
Janek