X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Flocal%2Flib.pm;h=41a51d64dbf877926c12cbe94ebca7d4b6d83118;hb=c40e10d7a5fafb4895f6228b5f6e532e3288fa09;hp=9943542a752ab331aa0c65e2f8097dd028b79b88;hpb=42c7045899d0144c1942b7873fbbb172940c96ae;p=p5sagit%2Flocal-lib.git diff --git a/lib/local/lib.pm b/lib/local/lib.pm index 9943542..41a51d6 100644 --- a/lib/local/lib.pm +++ b/lib/local/lib.pm @@ -45,6 +45,9 @@ DEATH my $shell = defined $1 ? $1 : shift @args; $opts{shelltype} = $shell; } + elsif ( $arg eq '--no-create' ) { + $opts{no_create} = 1; + } elsif ( $arg =~ /^--/ ) { die "Unknown import argument: $arg"; } @@ -88,6 +91,7 @@ sub bins { $_[0]->{bins} ||= [ \'PATH' ] } sub roots { $_[0]->{roots} ||= [ \'PERL_LOCAL_LIB_ROOT' ] } sub extra { $_[0]->{extra} ||= {} } sub shelltype { $_[0]->{shelltype} ||= $_[0]->guess_shelltype } +sub no_create { $_[0]->{no_create} } my $_archname = $Config{archname}; my $_version = $Config{version}; @@ -220,7 +224,8 @@ sub activate { my ($self, $path) = @_; $self = $self->new unless ref $self; $path = $self->resolve_path($path); - $self->ensure_dir_structure_for($path); + $self->ensure_dir_structure_for($path) + unless $self->no_create; my @active_lls = $self->active_paths; @@ -305,6 +310,10 @@ sub environment_vars_string_for { && ${$value->[0]} eq $name) { next; } + if (!ref $value + && $value eq $ENV{$name}) { + next; + } $out .= $self->$build_method($name, $value); } return $out; @@ -792,6 +801,17 @@ was added by C, instead of adding it. Remove all directories that were added to search paths by C from the search paths. +=head2 --shelltype + +Specify the shell type to use for output. By default, the shell will be +detected based on the environment. Should be one of: C, C, +C, or C. + +=head2 --no-create + +Prevents C from creating directories when activating dirs. This is +likely to cause issues on Win32 systems. + =head1 METHODS =head2 ensure_dir_structure_for @@ -824,7 +844,7 @@ given path as the base directory. =over 4 -=item Arguments: $path, $interpolate +=item Arguments: $path =item Return value: %environment_vars