# HG changeset patch # User Meredith Howard # Date 1518726522 18000 # Node ID 31d13f6d3a308411a4a56c743231aa5d3895f9b0 # Parent a478dd55388a8e5742bc3eb557330c98a4522a35 make inline-friendly diff --git a/.lib/perl5/Autofetch.pm b/.lib/perl5/Autofetch.pm --- a/.lib/perl5/Autofetch.pm +++ b/.lib/perl5/Autofetch.pm @@ -15,15 +15,19 @@ sub cachepath { sub modulefy { $_[0] =~ s/\.pm$//r =~ s|/|::|gr } -my $path = cachepath($0); -my $incpath = catfile($path, 'lib', 'perl5'); +sub import { + return if our $INSTALLED++; + + my $path = cachepath($0); + my $incpath = catfile($path, 'lib', 'perl5'); -push @INC, $incpath, sub { - my (undef, $file) = @_; + push @INC, $incpath, sub { + my (undef, $file) = @_; - fetch($path, modulefy($file)); + fetch($path, modulefy($file)); - return IO::File->new(catfile($incpath, $file)); -}; + return IO::File->new(catfile($incpath, $file)); + }; +} 1;