use on::demand "My::Module"; # My::Module is not loaded my $var = My::Module->new(); # require My::Module and jump to its new() method
Deferred loading of modules with large dependency footprint may improve test script and/or command-line tools load times.
Autoload is used. No performance penalty is imposed, aside from loading the module on the first call to it.
Of course, the drawback is that compile time errors (if any) are delayed until unexpected. Better check that the modules in question actually exist and load correctly.