From: Vincent Pit Date: Sun, 25 Jan 2009 22:55:48 +0000 (+0100) Subject: Cache the result of format_available() X-Git-Tag: v0.06~9 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=0b48b505ce499b8ac199dd921aed721105398d75;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git Cache the result of format_available() --- diff --git a/lib/CPANPLUS/Dist/Gentoo.pm b/lib/CPANPLUS/Dist/Gentoo.pm index 3813281..ed048f9 100644 --- a/lib/CPANPLUS/Dist/Gentoo.pm +++ b/lib/CPANPLUS/Dist/Gentoo.pm @@ -70,11 +70,15 @@ sub _unquote { return $s; } +my $format_available; + sub format_available { + return $format_available if defined $format_available; + for my $prog (qw/emerge ebuild/) { unless (can_run($prog)) { error "$prog is required to write ebuilds -- aborting"; - return 0; + return $format_available = 0; } } @@ -104,7 +108,7 @@ sub format_available { $default_keywords = [ 'x86' ] unless defined $default_keywords; $default_distdir = '/usr/portage/distfiles' unless defined $default_distdir; - return 1; + return $format_available = 1; } sub init {