Speedup by by 63 % (from 85 ms to 52 ms on a 3 GHz P4) for a typical
usecase (prepend single directory to PATH with 12 directories with checking) by loading Pod::Usage only if necessary. This script is called quite frequently in my .zshrc, so performance is important (maybe I should rewrite it in C?)
This commit is contained in:
parent
60f1952973
commit
69187e640a
|
@ -38,7 +38,6 @@ Peter J. Holzer <hjp@hjp.at>.
|
|||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
||||
my $check;
|
||||
my $debug;
|
||||
|
@ -46,7 +45,11 @@ my $var = 'PATH';
|
|||
GetOptions("check" => \$check,
|
||||
"debug" => \$debug,
|
||||
"var=s" => \$var,
|
||||
) or pod2usage(2);
|
||||
) or do {
|
||||
require Pod::Usage;
|
||||
import Pod::Usage;
|
||||
pod2usage(2);
|
||||
};
|
||||
|
||||
my $path = $ENV{$var} || '';
|
||||
my @path = split(/:/, $path);
|
||||
|
|
Loading…
Reference in New Issue