App-rlibperl
    
    
  
  
  
view release on metacpan or search on metacpan
lib/App/rbinperl.pm view on Meta::CPAN
and Apache would run your perl script through plack
which would detect an C<FCGI> environment and then load your web app.
If plack and your web framework are installed into a local lib
this won't work.  Instead you can do this:
  #!/home/username/perl5/bin/rbinperl plackup
  require 'mywebapp.pl';
It's almost as easy, and makes the rest
(loading your local lib) transparent.
=head1 BUGS AND LIMITATIONS
Unfortunately the shebang described above isn't entirely portable.
If you are on an operating system that doesn't allow
using another script (as opposed to a binary) in the shebang,
you may be able to use a work around like this instead:
  #!/bin/sh
    
  
  
  use Test::More;
plan tests => 1;
{
  my $tree = named_tree( 'parent' );
  # this can't be portable...
  my $out = qx!perl -e "print qq[foo\$/bar\$/]" | $tree->{rlibperl} -pe "tr/aeiou/AEIOU/"!;
  is $out, "fOO$/bAr$/", 'STDIN piped transparently';
}
    
  
  
  
( run in 0.558 second using v1.01-cache-2.11-cpan-a1d94b6210f )