PageRenderTime 65ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/Apache/Voodoo/Zombie.pm

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