Skip to content

Commit 0ce5430

Browse files
committed
Create perl5lib link...
1 parent db10307 commit 0ce5430

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

lib/App/p5stack.pm

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ sub new {
3131
sub run {
3232
my ($self) = @_;
3333

34-
if ($self->{command} eq 'setup') { $self->_do_setup; }
35-
elsif ($self->{command} eq 'perl') { $self->_do_perl; }
34+
if ($self->{command} eq 'setup') { $self->_do_setup; }
35+
elsif ($self->{command} eq 'perl') { $self->_do_perl; }
3636
elsif ($self->{command} eq 'cpanm') { $self->_do_cpanm; }
37-
elsif ($self->{command} eq 'bin') { $self->_do_bin; }
38-
elsif ($self->{command} eq 'run') { $self->_do_run; }
37+
elsif ($self->{command} eq 'bin') { $self->_do_bin; }
38+
elsif ($self->{command} eq 'run') { $self->_do_run; }
3939
else { $self->_do_help; }
4040
}
4141

@@ -86,11 +86,11 @@ sub _do_config {
8686
}
8787

8888
# set more stuff
89-
$self->{home} = getcwd;
89+
$self->{home} = getcwd;
9090
$self->{local_lib} = catfile($self->{home},'.local',$self->{perl_version});
9191
$self->{local_bin} = catfile($self->{home},'.local',$self->{perl_version},'bin');
92-
$self->{Ilib} = catfile($self->{home},'.local',$self->{perl_version},'lib','perl5');
93-
$self->{log_file} = catfile($self->{p5stack_root},'p5stack-setup.log');
92+
$self->{Ilib} = catfile($self->{home},'.local',$self->{perl_version},'lib','perl5');
93+
$self->{log_file} = catfile($self->{p5stack_root},'p5stack-setup.log');
9494
}
9595

9696
sub _do_setup {
@@ -138,12 +138,22 @@ sub _do_setup {
138138
$self->_do_cpanm("--installdeps .");
139139
}
140140

141+
$self->_do_perl5lib_link();
142+
141143
if ($self->{cpanm_flag}) {
142144
_log("[p5stack] Warning, cpanm may have failed to install something!");
143145
}
144146
_log("[p5stack] Setup done, use 'p5stack perl' to run your application.");
145147
}
146148

149+
sub _do_perl5lib_link {
150+
my ($self) = @_;
151+
152+
my $target = catfile($self->{home}, '.local', 'perl5lib');
153+
unlink $target if -e $target;
154+
symlink $self->{Ilib}, $target;
155+
}
156+
147157
sub _get_cpanm {
148158
my ($self) = @_;
149159

0 commit comments

Comments
 (0)