package MyBar; ... sub Bar { my $val = XV_bar(@_); return $val; } ... # do the XS imports... # and your code that calls the bar # Foo.pl use strict; use warnings; use MyBar; my $n = 1 + MyBar::Bar(...); # ^ warning will be generated here, not in your module, Bar.pm.