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))
BEGIN blocks execute at compile time, not run time.use Pod::Usage; # is the same as BEGIN { require Pod::Usage; Pod::Usage->import(); }
Assuming that often you run without ever using the Pod functions,
and you want to fire that module up only if you will be needing it,
you could have a runtime flag like this:
I leave it you to decide how this applies to your code. You have to do the require and import before using any functionality of Pod::Usage.if ($needPod) { require Pod::Usage; Pod::Usage->import(); }
Usually GetOPt::Std is enough for me. I almost never use autodie and absolutely never use it in end user code.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: slow startup for some common modules? (autodie, Pod::Usage, Getopt::Long))
by almr (Beadle) on Jan 06, 2023 at 23:08 UTC | |
by LanX (Saint) on Jan 07, 2023 at 02:46 UTC |