~ubuntu-branches/ubuntu/edgy/libapache2-mod-perl2/edgy

« back to all changes in this revision

Viewing changes to ModPerl-Registry/lib/ModPerl/RegistryCooker.pm

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2004-08-19 06:23:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040819062348-jxl4koqbtvgm8v2t
Tags: 1.99.14-4
Remove the LFS CFLAGS, and build-dep against apache2-*-dev (>= 2.0.50-10)
as we're backing out of the apache2/apr ABI transition.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2001-2004 The Apache Software Foundation
 
2
#
 
3
# Licensed under the Apache License, Version 2.0 (the "License");
 
4
# you may not use this file except in compliance with the License.
 
5
# You may obtain a copy of the License at
 
6
#
 
7
#     http://www.apache.org/licenses/LICENSE-2.0
 
8
#
 
9
# Unless required by applicable law or agreed to in writing, software
 
10
# distributed under the License is distributed on an "AS IS" BASIS,
 
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
12
# See the License for the specific language governing permissions and
 
13
# limitations under the License.
 
14
#
1
15
# VERY IMPORTANT: Be very careful modifying the defaults, since many
2
16
# VERY IMPORTANT: packages rely on them. In fact you should never
3
17
# VERY IMPORTANT: modify the defaults after the package gets released,
25
39
use ModPerl::Global ();
26
40
 
27
41
use File::Spec::Functions ();
 
42
use File::Basename;
28
43
 
29
 
use Apache::Const -compile => qw(:common &OPT_EXECCGI);
 
44
use Apache::Const  -compile => qw(:common &OPT_EXECCGI);
 
45
use ModPerl::Const -compile => 'EXIT';
30
46
 
31
47
unless (defined $ModPerl::Registry::MarkLine) {
32
48
    $ModPerl::Registry::MarkLine = 1;
179
195
        %orig_inc = %INC;
180
196
    }
181
197
 
 
198
    my $rc = Apache::OK;
182
199
    { # run the code and preserve warnings setup when it's done
183
 
        no warnings;
 
200
        no warnings FATAL => 'all';
 
201
        #local $^W = 0;
184
202
        eval { $cv->($r, @_) };
 
203
 
 
204
        # log script's execution errors
 
205
        $rc = $self->error_check;
 
206
 
185
207
        ModPerl::Global::special_list_call(END => $package);
 
208
 
 
209
        # log script's END blocks execution errors
 
210
        my $new_rc = $self->error_check;
 
211
 
 
212
        # use the END blocks return status if the script's execution
 
213
        # was successful
 
214
        $rc = $new_rc if $rc != Apache::OK;
186
215
    }
187
216
 
188
217
    if ($self->should_reset_inc_hash) {
201
230
 
202
231
    #XXX: $self->chdir_file("$Apache::Server::CWD/");
203
232
 
204
 
    if ( (my $err_rc = $self->error_check) != Apache::OK) {
205
 
        return $err_rc;
206
 
    }
207
 
 
208
 
    return Apache::OK;
 
233
    return $rc;
209
234
}
210
235
 
211
236
 
360
385
 
361
386
    $self->strip_end_data_segment;
362
387
 
 
388
    # handle the non-parsed handlers ala mod_cgi (though mod_cgi does
 
389
    # some tricks removing the header_out and other filters, here we
 
390
    # just call assbackwards which has the same effect).
 
391
    my $base = File::Basename::basename($self->{FILENAME});
 
392
    my $nph = substr($base, 0, 4) eq 'nph-' ? '$_[0]->assbackwards(1);' : "";
363
393
    my $script_name = $self->get_script_name || $0;
364
394
 
365
395
    my $eval = join '',
367
397
                    $self->{PACKAGE}, ";",
368
398
                    "sub handler {",
369
399
                    "local \$0 = '$script_name';",
 
400
                    $nph,
370
401
                    $line,
371
402
                    ${ $self->{CODE} },
372
403
                    "\n}"; # last line comment without newline?
492
523
    no strict 'refs';
493
524
    my $tab = \%{ $self->{PACKAGE} . '::' };
494
525
 
 
526
    # below we assign to a symbol first before undef'ing it, to avoid
 
527
    # nuking aliases. If we undef directly we may undef not only the
 
528
    # alias but the original function as well
 
529
 
495
530
    for (keys %$tab) {
496
531
        my $fullname = join '::', $self->{PACKAGE}, $_;
497
532
        # code/hash/array/scalar might be imported make sure the gv
656
691
 
657
692
    $self->debug("compiling $self->{FILENAME}") if DEBUG && D_COMPILE;
658
693
 
659
 
    ModPerl::Global::special_list_clear(END => $self->{PACKAGE});
 
694
    ModPerl::Global::special_list_register(END => $self->{PACKAGE});
 
695
    ModPerl::Global::special_list_clear(   END => $self->{PACKAGE});
660
696
 
661
697
    {
662
698
        # let the code define its own warn and strict level 
678
714
 
679
715
sub error_check {
680
716
    my $self = shift;
681
 
    if ($@ and substr($@,0,4) ne " at ") {
 
717
 
 
718
    # ModPerl::Util::exit() throws an exception object whose rc is
 
719
    # ModPerl::EXIT
 
720
    # (see modperl_perl_exit() and modperl_errsv() C functions)
 
721
    if ($@ && !(ref $@ eq 'APR::Error' && $@ == ModPerl::EXIT)) {
682
722
        $self->log_error($@);
683
723
        return Apache::SERVER_ERROR;
684
724
    }