Perl Security: 3. Reporting warnings Warnings and modules A module can be registered to be controlled more easily: package This::Module; use warnings::register; sub testing { my $text = shift if (warnings::enabled() && $text=~/[abc]/) { warnings::warn('Text contains a, b or c.'); } } And then, from the main program: use This::Module; use warnings 'This::Module'; This::Module::testing('a simple string'); will send us the specified warning.