1docs::api::ModPerl::GloUbsaelr(3C)ontributed Perl Documednotcast:i:oanpi::ModPerl::Global(3)
2
3
4
6 ModPerl::Global -- Perl API for manipulating special Perl lists
7
9 use ModPerl::Global ();
10 my $package = 'MyApache2::Package';
11
12 # make the END blocks of this package special
13 ModPerl::Global::special_list_register(END => $package);
14
15 # Execute all encoutered END blocks from this package now
16 ModPerl::Global::special_list_call( END => $package);
17
18 # delete the list of END blocks
19 ModPerl::Global::special_list_clear( END => $package);
20
22 "ModPerl::Global" provides an API to manipulate special perl lists. At
23 the moment only the "END" blocks list is supported.
24
25 This API allows you to change the normal Perl behavior, and execute
26 special lists when you need to.
27
28 For example "ModPerl::RegistryCooker" uses it to run "END" blocks in
29 the scripts at the end of each request.
30
31 Before loading a module containing package $package, you need to
32 register it, so the special blocks will be intercepted by mod_perl and
33 not given to Perl. "special_list_register" does that. Later on when you
34 want to execute the special blocks, "special_list_call" should be
35 called. Unless you want to call the list more than once, clear the list
36 with "special_list_clear".
37
39 "ModPerl::Global" provides the following methods:
40
41 "special_list_call"
42 Call the special list
43
44 $ok = special_list_call($key => $package);
45
46 arg1: $key ( string )
47 The name of the special list. At the moment only 'END' is
48 supported.
49
50 arg2: $package ( string )
51 what package to special list is for
52
53 ret: $ok ( boolean )
54 true value if $key is known, false otherwise.
55
56 since: 2.0.00
57
58 "special_list_clear"
59 Clear the special list
60
61 $ok = special_list_clear($key => $package);
62
63 arg1: $key ( string )
64 The name of the special list. At the moment only 'END' is
65 supported.
66
67 arg2: $package ( string )
68 what package to special list is for
69
70 ret: $ok ( boolean )
71 true value if $key is known, false otherwise.
72
73 since: 2.0.00
74
75 "special_list_register"
76 Register the special list
77
78 $ok = special_list_call($key => $package);
79
80 arg1: $key ( string )
81 The name of the special list. At the moment only 'END' is
82 supported.
83
84 arg2: $package ( string )
85 what package to special list is for
86
87 ret: $ok ( boolean )
88 true value if $key is known, false otherwise.
89
90 since: 2.0.00
91
92 Notice that you need to register the package before it is loaded. If
93 you register it after, Perl has already compiled the "END" blocks and
94 there are no longer under your control.
95
97 mod_perl 2.0 documentation.
98
100 mod_perl 2.0 and its core modules are copyrighted under The Apache
101 Software License, Version 2.0.
102
104 The mod_perl development team and numerous contributors.
105
106
107
108perl v5.36.0 2023-01-19 docs::api::ModPerl::Global(3)