Merge pull request #2383 from solgenomics/dauglyon-patch-1
[sgn.git] / lib / CXGN / Apache / Registry.pm
blob2be4d540763b888126cbec5f1e15ed4758df2a3d
1 package CXGN::Apache::Registry;
2 use strict;
3 use warnings;
5 use base qw(ModPerl::RegistryPrefork);
6 use SGN::Context;
8 # add a global $c variable to the top of every script for the context
9 # object
10 my $cxgn_script_header = <<'EOC';
11 our $c = SGN::Context->instance;
12 EOC
13 sub get_mark_line {
14 my $self = shift;
15 return $cxgn_script_header.$self->SUPER::get_mark_line(@_);
18 sub read_script {
19 my $self = shift;
21 # keep site die handlers from interfering with proper 404 and 403
22 # error handling
23 local $SIG{__DIE__} = undef;
25 return $self->SUPER::read_script(@_);
30 __END__
32 =head1 NAME
34 CXGN::Apache::Registry - slightly customized subclass of L<ModPerl::RegistryPrefork>
36 =head1 DESCRIPTION
38 Adds a global
40 our $c = SGN::Context->instance
42 to the beginning of every script.
44 Localizes C<$SIG{__DIE__}> when reading script files from disk, to
45 enable proper 404 and 403 handling in the presence of custom
46 C<$SIG{__DIE__}> handlers.
48 =head1 Authors
50 Robert Buels
52 =cut