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";
}
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};
if (!grep { $_ eq $path } @active_lls) {
warn "Tried to deactivate inactive local::lib '$path'\n";
- return;
+ return $self;
}
my %args = (
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;
}
sub _legacy {
- my ($self, $path, $deactivating) = @_;
+ my ($self, $path) = @_;
$self = $self->new unless ref $self;
- $self = $self->${\($deactivating ? 'deactivate' : 'activate')}($path) if defined $path;
+ if (defined $path) {
+ $self = $self->activate($path);
+ }
$self;
}
&& ${$value->[0]} eq $name) {
next;
}
+ if (!ref $value
+ && $value eq $ENV{$name}) {
+ next;
+ }
$out .= $self->$build_method($name, $value);
}
return $out;
Remove all directories that were added to search paths by C<local::lib> 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<bourne>, C<csh>,
+C<cmd>, or C<powershell>.
+
+=head2 --no-create
+
+Prevents C<local::lib> from creating directories when activating dirs. This is
+likely to cause issues on Win32 systems.
+
=head1 METHODS
=head2 ensure_dir_structure_for
=over 4
-=item Arguments: $path, $interpolate
+=item Arguments: $path
=item Return value: %environment_vars