----- Original Message -----

> From: The Sidhekin <sidhe...@allverden.no>


> * How would you rewrite a test script such as my own
> http://cpansearch.perl.org/src/EBHANSSEN/Test-Trap-v0.2.2/t/00-load.t so
> that it does not use use_ok()?
> * Why would you? :-\


Just a quick hack:

    use Test::More;                                                             
                                                                  

    BEGIN {
        my @modules = qw(
          Test::Trap::Builder::TempFile
          Test::Trap::Builder::SystemSafe
          Test::Trap::Builder
          Test::Trap
        );
        push @modules => 'Test::Trap::Builder::PerlIO' if eval "use PerlIO; 1";
        plan tests => scalar @modules;

        for my $module (@modules) {
            eval "use $module";
            BAIL_OUT $@ if $@;
        }
    }


With that, you're using the actual use builtin and not worrying about extra 
code that might or might not be obscuring problems.

Cheers,
Ovid 
--
Live and work overseas - http://www.overseas-exile.com/
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog - http://blogs.perl.org/users/ovid/
Twitter - http://twitter.com/OvidPerl/

Reply via email to