in reply to Re^2: slow startup for some common modules? (autodie, Pod::Usage, Getopt::Long))
in thread slow startup for some common modules? (autodie, Pod::Usage, Getopt::Long))

I use this recipe in most scripts:
use Getopt::Long; sub pod2usage { require Pod::Usage; goto \&Pod::Usage::pod2usage; } GetOptions( ... ... ) or pod2usage(2);
I don't mind paying for Getopt::Long because I like its features, but there's no reason to load Pod::Usage unless the user screws up the commandline.

On that note, someone ought to contribute a patch to Pod::Usage that avoids loading anything until it gets called. Then I could skip that bit of ugly boilerplate in my code.

  • Comment on Re^3: slow startup for some common modules? (autodie, Pod::Usage, Getopt::Long))
  • Download Code