1Resurrector(3) User Contributed Perl Documentation Resurrector(3)
2
3
4
6 Log::Log4perl::Resurrector - Dark Magic to resurrect hidden L4p
7 statements
8
10 Loading "use Log::Log4perl::Resurrector" causes subsequently loaded
11 modules to have their hidden
12
13 ###l4p use Log::Log4perl qw(:easy);
14
15 ###l4p DEBUG(...)
16 ###l4p INFO(...)
17 ...
18
19 statements uncommented and therefore 'resurrected', i.e. activated.
20
21 This allows for a module "Foobar.pm" to be written with Log4perl
22 statements commented out and running at full speed in normal mode.
23 When loaded via
24
25 use Foobar;
26
27 all hidden Log4perl statements will be ignored.
28
29 However, if a script loads the module "Foobar" after loading
30 "Log::Log4perl::Resurrector", as in
31
32 use Log::Log4perl::Resurrector;
33 use Foobar;
34
35 then "Log::Log4perl::Resurrector" will have put a source filter in
36 place that will extract all hidden Log4perl statements in "Foobar"
37 before "Foobar" actually gets loaded.
38
39 Therefore, "Foobar" will then behave as if the
40
41 ###l4p use Log::Log4perl qw(:easy);
42
43 ###l4p DEBUG(...)
44 ###l4p INFO(...)
45 ...
46
47 statements were actually written like
48
49 use Log::Log4perl qw(:easy);
50
51 DEBUG(...)
52 INFO(...)
53 ...
54
55 and the module "Foobar" will indeed be Log4perl-enabled. Whether any
56 activated Log4perl statement will actually trigger log messages, is up
57 to the Log4perl configuration, of course.
58
59 There's a startup cost to using "Log::Log4perl::Resurrector" (all
60 subsequently loaded modules are examined) but once the compilation
61 phase has finished, the perl program will run at full speed.
62
63 Some of the techniques used in this module have been stolen from the
64 "Acme::Incorporated" CPAN module, written by chromatic. Long live CPAN!
65
67 Copyright 2002-2009 by Mike Schilli <m@perlmeister.com> and Kevin Goess
68 <cpan@goess.org>.
69
70 This library is free software; you can redistribute it and/or modify it
71 under the same terms as Perl itself.
72
73
74
75perl v5.12.2 2010-08-31 Resurrector(3)