File Coverage

blib/lib/Apache/Voodoo/Zombie.pm
Criterion Covered Total %
statement 23 25 92.0
branch 2 4 50.0
condition n/a
subroutine 5 6 83.3
pod 0 1 0.0
total 30 36 83.3


line stmt bran cond sub pod time code
1             =pod #####################################################################################
2              
3             =head1 NAME
4              
5             Apache::Voodoo::Zombie - Internal module used by Voodoo when a end user module doesn't compile.
6              
7             =head1 SYNOPSIS
8              
9             This module is used by Apache::Voodoo::Application as a stand in for a module that didn't compile
10             when either devel_mode or debug is 1 in the application's voodoo.conf. Any calls to this module simply
11             throw an exception describing the describing the compilation error.
12             This is a development tool...you shouldn't have any Zombies in your production environment :)
13              
14             =cut ################################################################################
15             package Apache::Voodoo::Zombie;
16              
17             $VERSION = "3.0200";
18              
19 3     3   1718 use strict;
  3         7  
  3         122  
20 3     3   18 use warnings;
  3         8  
  3         104  
21              
22 3     3   1203 use Apache::Voodoo::Exception;
  3         7  
  3         690  
23              
24             sub new {
25 2     2 0 817 my $class = shift;
26 2         5 my $module = shift;
27 2         3 my $error = shift;
28              
29 2         8 my $self = {
30             'module' => $module,
31             'error' => $error
32             };
33              
34 2         7 bless ($self,$class);
35 2         8 return $self;
36             }
37              
38             #
39             # Autoload is used to catch whatever method was supposed to be invoked
40             # in the dead module.
41             #
42             sub AUTOLOAD {
43 1 50   1   14 next unless ref($_[0]);
44              
45 1         2 my $self = shift;
46 1         2 my $p = shift;
47              
48 1         2 our $AUTOLOAD;
49 1         2 my $method = $AUTOLOAD;
50 1         6 $method =~ s/.*:://;
51              
52 1 50       3 if (ref($Apache::Voodoo::Engine::debug)) {
53 0         0 $Apache::Voodoo::Engine::debug->error($self->{'module'},$self->{'error'});
54             }
55              
56             Apache::Voodoo::Exception::Compilation->throw(
57 1         17 'module' => $self->{'module'},
58             'error' => $self->{'error'}
59             );
60             }
61              
62             # keeps autoloader from making one
63 0     0     sub DESTROY {}
64              
65             1;
66              
67             ################################################################################
68             # Copyright (c) 2005-2010 Steven Edwards (maverick@smurfbane.org).
69             # All rights reserved.
70             #
71             # You may use and distribute Apache::Voodoo under the terms described in the
72             # LICENSE file include in this package. The summary is it's a legalese version
73             # of the Artistic License :)
74             #
75             ################################################################################