Some modules like XML::Simple export some functions by default into your namespace. Normally you don’t want this functions since the module has a OO interface; so, how to avoid the auto-export from taint your namespace ?

You can, at include time, be careful and explicitly tell the module not to export anything by doing this:

use XML::Simple qw();

But what if you are using a bunch of modules and you aren’t really sure of everything each one of them exports? You can either tell each one to export nothing ( qw() ) or you can use use namespace::clean.

namespace::clean defines a pragma that cleans up your namespace from exported functions. When you use the pragma all the exported functions to that point are cleaned-out from your namespace.

So if your using a lot of modules you can use it like this:

use strict;

use Foo;
use Bar;

use namespace::clean; #all Foo and Bar exported functions are cleaned out from your namespace

use Carp; #croak is available on your namespace