1use strict; 2use warnings; 3 4use Test::More 0.88; 5 6{ 7 package Foo; 8 use Scalar::Util qw(blessed); 9 sub mysub { } 10 use namespace::autoclean -except => ['blessed']; 11} 12 13ok( Foo->can('mysub'), 'Foo has mysub method' ); 14ok( Foo->can('blessed'), 'Foo has blessed sub - passed to -except as arrayref' ); 15 16{ 17 package Bar; 18 use Scalar::Util qw(blessed); 19 sub mysub { } 20 use namespace::autoclean -except => 'blessed'; 21} 22 23ok( Bar->can('mysub'), 'Bar has mysub method' ); 24ok( Bar->can('blessed'), 'Bar has blessed sub - passed to -except as string' ); 25 26{ 27 package Baz; 28 use Scalar::Util qw(blessed); 29 sub mysub { } 30 use namespace::autoclean -except => qr/bless/; 31} 32 33ok( Baz->can('mysub'), 'Baz has mysub method' ); 34ok( Baz->can('blessed'), 'Baz has blessed sub - passed to -except as regex' ); 35 36done_testing(); 37