| 1 | package # hide the package from the PAUSE indexer | ||
| 2 | Apache::DB; | ||
| 3 | |||
| 4 | use 5.005; | ||
| 5 | use strict; | ||
| 6 | use DynaLoader (); | ||
| 7 | |||
| 8 | BEGIN { | ||
| 9 | use constant MP2 => eval { | ||
| 10 | exists $ENV{MOD_PERL_API_VERSION} and $ENV{MOD_PERL_API_VERSION} >= 2 | ||
| 11 | }; | ||
| 12 | die "mod_perl is required to run this module: $@" if $@; | ||
| 13 | } | ||
| 14 | |||
| 15 | { | ||
| 16 | no strict; | ||
| 17 | @ISA = qw(DynaLoader); | ||
| 18 | $VERSION = '0.18'; | ||
| 19 | __PACKAGE__->bootstrap($VERSION); | ||
| 20 | } | ||
| 21 | |||
| 22 | $Apache::Registry::MarkLine = 0; | ||
| 23 | |||
| 24 | sub init { | ||
| 25 | if(init_debugger()) { | ||
| 26 | warn "[notice] Apache::DB initialized in child $$\n"; | ||
| 27 | } | ||
| 28 | |||
| 29 | 1; | ||
| 30 | } | ||
| 31 | |||
| 32 | use Data::Dumper; | ||
| 33 | sub handler { | ||
| 34 | my $r = shift; | ||
| 35 | |||
| 36 | init(); | ||
| 37 | |||
| 38 | { | ||
| 39 | local $@; | ||
| 40 | my $loaded_db; | ||
| 41 | |||
| 42 | if ($ENV{PERL5DB}) { | ||
| 43 | (my $directive = $ENV{PERL5DB}) | ||
| 44 | =~ s/^\s*BEGIN\s*{\s*(.*)\s*}\z/$1/s; | ||
| 45 | $directive =~ s/^require\b/do/; | ||
| 46 | $loaded_db = eval($directive); | ||
| 47 | } | ||
| 48 | } | ||
| 49 | |||
| 50 | $DB::state[0]{single} = !$DB::options{ NonStop }; | ||
| 51 | warn "Debugger state " .Dumper \@DB::state; | ||
| 52 | warn "Debugger options " .Dumper \%DB::options; | ||
| 53 | return 0; | ||
| 54 | } | ||
| 55 | |||
| 56 | 1; | ||
| 57 | __END__ |