use 5.010; use strict; use warnings; use Test::More; { package Foo; use constant XYZ => 123; use namespace::clean; sub add_xyz { shift; return XYZ + $_[0] }; } ok( !Foo->can('XYZ'), 'constant was cleaned away' ); ok( Foo->can('add_xyz'), 'method still exists' ); is( Foo->add_xyz(100), 223, 'method works properly' ); done_testing;