NAME
App::rbinperl - Execute perl using relative lib and assuming -S
VERSION
version 0.601
SYNOPSIS
Simplify cron jobs or other places where you specify commands to execute which don't have your full environment.
Instead of:
* * * * * perl -I/home/username/perl5/lib/perl5 \
/home/username/perl5/bin/somescript
Do:
* * * * * /home/username/perl5/bin/rbinperl somescript
This is even more useful in a shebang line which is often limited to a single argument...
This won't work on linux:
#!/usr/bin/env perl -I/home/username/perl5/lib/perl5 -S plackup
This will:
#!/home/username/perl5/bin/rbinperl plackup
This example can be handy in a shared hosting environment where you install the modules you want using local::lib and then want to use plackup to run your app from apache as a CGI or FCGI script.
DESCRIPTION
The rbinperl
script simplifies the execution of a perl script that depends on modules located in relative library directories.
This uses the same logic as App::rlibperl to prepend relative lib directories to @INC
and additionally passes the -S
argument to perl. This causes perl to search the $PATH
(which now contains the directory where rbinperl
was found) for the specified script.
EXAMPLE USAGE WITH local::lib
If you have installed App::MadeUpScript
(and App::rbinperl
) via local::lib your directory tree will look something like this:
${root}/bin/rbinperl
${root}/bin/made-up-script
${root}/lib/perl5/${modules}
${root}/lib/perl5/${archname}/${extras}
${root}/man/${docs}
When you're using a login shell with local::lib enabled you can just call made-up-script
from the shell because your environment variables are configured such that ${root}/bin
is in your $PATH
and ${root}/lib/perl5
is in $PERL5LIB
.
However to run from any sort of detached process the environment variables from local::lib won't be available, and you'd have to do this instead:
$ perl -I${root}/lib/perl5 -S made-up-script
rbinperl
simplifies this by adding the relative lib directories automatically and passing -S
:
$ ${root}/bin/rbinperl made-up-script
BLAH BLAH BLAH
Honestly the script itself is much simpler than explaining how it can be useful (if it even is useful).
SEE ALSO
AUTHOR
Randy Stauner <rwstauner@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Randy Stauner.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.