6 use lib
"$ENV{LJHOME}/cgi-bin";
8 # this code prevents the XS version of Params::Classify from loading
9 # we do this because the combination of Params::Classify, IpMap, and
10 # mod_perl seems to segfault after apache forks
13 my $old_load = \
&XSLoader
::load
;
14 local *XSLoader
::load
= sub {
16 my ($pkgname) = @args;
17 die if $pkgname eq 'Params::Classify';
20 eval { require Params
::Classify
};
27 # Image::Size wants to pull in Image::Magick. Let's not let it during
29 my $still_loading = 1;
32 return undef unless $still_loading;
33 return undef unless $f eq "Image/Magick.pm";
34 die "Will not start with Image/Magick.pm"; # makes the require fail, which Image::Size traps
37 # pull in libraries and do per-start initialization once.
38 require "modperl_subs.pl";
42 # do per-restart initialization
43 LJ
::ModPerl
::setup_restart
();
45 # delete itself from %INC to make sure this file is run again
46 # when apache is restarted
47 delete $INC{"$ENV{'LJHOME'}/cgi-bin/modperl.pl"};
49 # remember modtime of all loaded libraries
50 %LJ::LIB_MOD_TIME
= ();
51 while (my ($k, $file) = each %INC) {
52 next if $LJ::LIB_MOD_TIME
{$file};
53 next unless $file =~ m!^\Q$LJ::HOME\E!;
54 my $mod = (stat($file))[9];
55 $LJ::LIB_MOD_TIME
{$file} = $mod;
58 # compatibility with old location of LJ::email_check:
59 *BMLCodeBlock
::check_email
= \
&LJ
::check_email
;
62 ## Signal handler for debugging infinite loops
63 ## Taken from: http://perl.apache.org/docs/1.0/guide/debug.html
64 ## Usage: kill -USR2 <pid>
67 $SIG{'USR2'} = sub { Carp
::confess
("caught SIGUSR2!"); };
73 $LJ::HARDWARE_SERVER_NAME
= hostname
();