FindApp
view release on metacpan or search on metacpan
lib/FindApp.pm view on Meta::CPAN
export PERL5LIB="/home/tchrist/src/corp-app/lib:$PERL5LIB";
export PATH-"/home/tchrist/src/corp-app/bin:$PATH";
Except that it only does a C<use lib> on the library directory it found; it doesn't
actually muck with your PERL5LIB variable.
That's something you could eval directly from your shell. This even
srcs for I<csh> and I<tcsh> users, because they see something different:
tcsh% perl -MFindApp -e 'print FindApp->shell_settings'
setenv APP_ROOT "/home/tchrist/src/corp-app";
setenv PERL5LIB "/home/tchrist/src/corp-app/lib:$PERL5LIB";
setenv PATH "/home/tchrist/src/corp-app/bin:$PATH";
You can add constraints to the root directory itself or the bin set, the lib set,
or the man set. For example,
use FindApp -LIB "t/lib", # add new lib possibility
-BIN "bin/utils", # add new bin possibility
-bin "app.fcgi", # add new bin requirement
qw(MyCorp::CorpApp MyCorp::CorpApp::Test); # add two lib requirements
The constraint text after that would be:
lib/FindApp/Object/Behavior.pm view on Meta::CPAN
sub show_shell_var {
&all_args_defined;
my $self = &myself;
state $poly = { map { $_ => 1 } qw(PERL5LIB PATH MANPATH) };
my($varname, @dirs) = @_;
$varname =~ /^\w+$/ || croak "$varname doesn't look like a good shell variable name";
my $retstr = q();
if (@dirs) {
$retstr = is_csh()
? "setenv $varname "
: "export $varname=" ;
push(@dirs, '$' . $varname) if $$poly{$varname};
$retstr .= sprintf qq{"%s";\n}, colonize @dirs;
}
return $retstr;
}
#################################################################
# BUILDERS
#################################################################
( run in 0.787 second using v1.01-cache-2.11-cpan-3989ada0592 )