Changeset 668
- Timestamp:
- 08/22/06 16:43:51 (2 years ago)
- Files:
-
- branches/wheeljack/lib/MT/Bootstrap.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/wheeljack/lib/MT/Bootstrap.pm
r2 r668 2 2 3 3 use strict; 4 use MT;5 4 6 5 sub BEGIN { … … 37 36 38 37 if ($class) { 38 # When running under FastCGI, the initial invocation of the 39 # script has a bare environment. We can use this to test 40 # for FastCGI. 41 my $not_fast_cgi = 0; 42 $not_fast_cgi ||= exists $ENV{$_} 43 for qw(HTTP_HOST GATEWAY_INTERFACE SCRIPT_FILENAME SCRIPT_URL); 44 my $fast_cgi = (!$not_fast_cgi) || $param{FastCGI}; 45 require CGI::Fast if $fast_cgi; 46 39 47 # ready to run now... run inside an eval block so we can gracefully 40 48 # die if something bad happens 41 49 my $app; 42 50 eval { 51 require MT; 43 52 eval "require $class; 1;" or die $@; 44 $app = $class->new( %param ) or die $class->errstr; 45 local $SIG{__WARN__} = sub { $app->trace($_[0]) }; 46 MT->set_instance($app); 47 $app->run; 53 if ($fast_cgi) { 54 while (my $cgi = new CGI::Fast) { 55 $app = $class->new( %param ) or die $class->errstr; 56 local $SIG{__WARN__} = sub { $app->trace($_[0]) }; 57 MT->set_instance($app); 58 $app->init_request(CGIObject => $cgi) 59 unless $app->{init_request}; 60 $app->run; 61 } 62 } else { 63 $app = $class->new( %param ) or die $class->errstr; 64 local $SIG{__WARN__} = sub { $app->trace($_[0]) }; 65 $app->run; 66 } 48 67 }; 49 68 if (my $err = $@) {
