[Jifty-commit] r2765 - in jifty/trunk/lib/Jifty: .

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Feb 8 04:24:55 EST 2007


Author: audreyt
Date: Thu Feb  8 04:24:55 2007
New Revision: 2765

Modified:
   jifty/trunk/lib/Jifty/Script.pm
   jifty/trunk/lib/Jifty/Script/FastCGI.pm

Log:
* Jifty::Script - Assume "jifty fastcgi" when we are running under cgi.

Modified: jifty/trunk/lib/Jifty/Script.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Script.pm	(original)
+++ jifty/trunk/lib/Jifty/Script.pm	Thu Feb  8 04:24:55 2007
@@ -5,9 +5,13 @@
 =head2 prepare
 
 C<prepare> figures out which command to run. If the user wants
-C<--help> give them help. If they have no command on the commandline,
-but a JIFTY_COMMAND environment variable, try that. If they have
-neither, shows the help. Otherwise, let App::CLI figure it out.
+C<--help> give them help.
+
+In the normal case, let App::CLI figure out the commandline.
+If they have no command on the commandline, but a JIFTY_COMMAND
+environment variable, try that.  Otherwise, if the GATEWAY_INTERFACE
+environment variable is set, assume we are running under CGI with the
+C<fastcgi> command.  If all fails, shows the help.
 
 =cut
 
@@ -16,11 +20,17 @@
     if ($ARGV[0] =~ /--?h(elp?)/i) {
         shift @ARGV; #discard the --help
         unshift @ARGV, 'help';
-    } elsif (!$ARGV[0] and $ENV{'JIFTY_COMMAND'}) {
-        my $cmd = $ENV{'JIFTY_COMMAND'};
-        unshift @ARGV, $cmd;
-    } elsif (! @ARGV) {
-        unshift @ARGV, 'help';
+    }
+    elsif (!@ARGV) {
+        if ( my $cmd = $ENV{'JIFTY_COMMAND'} ) {
+            unshift @ARGV, $cmd;
+        }
+        elsif ( $ENV{GATEWAY_INTERFACE} ) {
+            unshift @ARGV, 'fastcgi';
+        }
+        else {
+            unshift @ARGV, 'help';
+        }
     }
     return $self->SUPER::prepare(@_);
 }

Modified: jifty/trunk/lib/Jifty/Script/FastCGI.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Script/FastCGI.pm	(original)
+++ jifty/trunk/lib/Jifty/Script/FastCGI.pm	Thu Feb  8 04:24:55 2007
@@ -19,13 +19,12 @@
 new world-changing application is generating, you'll need something a bit heavier-duty
 than the pure-perl Jifty standalone server.  C<FastCGI> is what you're looking for.
 
-Because Apache's FastCGI dispatcher can't pass commandline flags to your script, you'll need
-to call jifty a bit differently:
-
+ # These two lines are FastCGI-specific; skip them to run in vanilla CGI mode
  AddHandler fastcgi-script fcgi
+ FastCgiServer /path/to/your/jifty/app/bin/jifty
+
  DocumentRoot /path/to/your/jifty/app/share/web/templates
- FastCgiServer /path/to/your/jifty/app/bin/jifty -initial-env JIFTY_COMMAND=fastcgi
- ScriptAlias /  /path/to/your/jifty/app/bin/jifty/
+ ScriptAlias / /path/to/your/jifty/app/bin/jifty/
 
 For B<lighttpd> (L<http://www.lighttpd.net/>), use this setting:
 


More information about the Jifty-commit mailing list