On Sun, Dec 31, 2006 at 04:59:16AM +0100, A. Pagaltzis wrote: > You’re not using enough magic. If you *really* want to make your > tests run even if Test::Exception isn’t installed, stick the test > in a BEGIN block that conditionally installs a `dies_ok` stub. > Something like > > BEGIN { > unless( eval "use Test::Exception; 1" ) { > *dies_ok = sub { SKIP: { > skip "Need Test::Exception for: $_[1]", 1; > } }; > } > } > > Something like that anyway; untested.
Well, that looks a good start; but maybe we can go one better: BEGIN { unless( eval "use Test::Exception; 1" ) { *dies_ok = sub(&$) { my ( $code, $msg ) = @_; eval { $code->(); 1 } and fail( $msg ); }; } } Is this "as good" as T::E's version? -- Paul "LeoNerd" Evans [EMAIL PROTECTED] ICQ# 4135350 | Registered Linux# 179460 http://www.leonerd.org.uk/
signature.asc
Description: Digital signature