first, write Foo.pm:

package Foo;
use Moose;
use namespace::clean;

no Moose;

1;

and test.t

use Test::More tests => 1;
use_ok 'Foo';

and run it:

[danjou@sylvia] $ prove test.t
test.t .. ok   
All tests successful.
Files=1, Tests=1,  0 wallclock secs ( 0.05 usr  0.01 sys +  0.08 cusr  0.01 csys =  0.15 CPU)
Result: PASS

great. but, with Devel::Cover,

[danjou@sylvia] $ HARNESS_PERL_SWITCHES=-MDevel::Cover prove test.t
test.t .. 1/1 
#   Failed test 'use Foo;'

#   at test.t line 2.

#     Tried to use 'Foo'.

#     Error:  Can't use an undefined value as a symbol reference at /Users/danjou/perl5/lib/perl5/namespace/clean.pm line 170.

# Compilation failed in require at (eval 27)[/Users/danjou/perl5/lib/perl5/Test/More.pm:745] line 2.

# BEGIN failed--compilation aborted at (eval 27)[/Users/danjou/perl5/lib/perl5/Test/More.pm:745] line 2.

# Looks like you failed 1 test of 1.

test.t .. Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/1 subtests 

Test Summary Report
                                                                        - test.t (Wstat: 256 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
Files=1, Tests=1,  2 wallclock secs ( 0.05 usr  0.01 sys +  1.08 cusr  0.05 csys =  1.19 CPU)
Result: FAIL

It fails!!!

update:

http://rt.cpan.org/Public/Bug/Display.html?id=45637> you can easily make the test pass by not explicitly inimporting the Moose keywords using ‘no Moose’ before namespace::clean gets a chance to do it. There’s really no point in doing that. «