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:
hjp 2007-03-05 18:13:54 +00:00
parent 60f1952973
commit 69187e640a
1 changed files with 5 additions and 2 deletions

View File

@ -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);