~ubuntu-branches/ubuntu/edgy/libapache2-mod-perl2/edgy-updates

« back to all changes in this revision

Viewing changes to docs/api/ModPerl/Util.pod

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2004-08-19 06:23:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040819062348-jxl4koqbtvgm8v2t
Tags: 1.99.14-4
Remove the LFS CFLAGS, and build-dep against apache2-*-dev (>= 2.0.50-10)
as we're backing out of the apache2/apr ABI transition.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
=head1 NAME
2
2
 
3
 
ModPerl::Util -- Helper mod_perl 2.0 Functions
4
 
 
5
 
=head1 SYNOPSIS
 
3
ModPerl::Util - Helper mod_perl 2.0 Functions
 
4
 
 
5
 
 
6
 
 
7
 
 
8
=head1 Synopsis
6
9
 
7
10
  use ModPerl::Util;
8
11
  
12
15
  
13
16
  ModPerl::Util::untaint($) # secret API?
14
17
 
15
 
=head1 DESCRIPTION
 
18
 
 
19
 
 
20
 
 
21
=head1 Description
16
22
 
17
23
C<ModPerl::Util> provides mod_perl 2.0 util functions.
18
24
 
 
25
 
 
26
 
 
27
 
 
28
 
19
29
=head1 API
20
30
 
21
 
=over
22
 
 
23
 
=item * current_callback
24
 
 
25
 
Returns the currently running callback, like 'PerlResponseHandler'
26
 
 
27
 
=item * exit
28
 
 
29
 
Used internally to replace CORE::exit and terminate the request,
30
 
not the current process.
31
 
 
32
 
=back
 
31
C<ModPerl::Util> provides the following functions and/or methods:
 
32
 
 
33
 
 
34
 
 
35
 
 
36
=head2 C<untaint>
 
37
 
 
38
Untaint the variable, by turning its tainted bit off (used internally).
 
39
 
 
40
  untaint($var);
 
41
 
 
42
=over 4
 
43
 
 
44
=item arg1: C<$var> (scalar)
 
45
 
 
46
=item ret: no return value
 
47
 
 
48
=back
 
49
 
 
50
Do not use this function unless you know what you are doing. To learn
 
51
how to properly untaint variables refer to the I<perlsec> manpage.
 
52
 
 
53
 
 
54
=head2 C<current_callback>
 
55
 
 
56
Returns the currently running callback, like 'PerlResponseHandler'.
 
57
 
 
58
  $callback = Apache::current_callback();
 
59
 
 
60
=over 4
 
61
 
 
62
=item ret: C<$callback> (string)
 
63
 
 
64
=back
 
65
 
 
66
 
 
67
 
 
68
 
 
69
 
 
70
=head2 C<exit>
 
71
 
 
72
Terminate the request, but not the current process (or not the current
 
73
Perl interpreter with threaded mpms).
 
74
 
 
75
  ModPerl::Util::exit($status);
 
76
 
 
77
=over 4
 
78
 
 
79
=item opt arg1: C<$status> (integer)
 
80
 
 
81
The exit status, which as of this writing is ignored.
 
82
 
 
83
=item ret: no return value
 
84
 
 
85
=item since: 1.99_14
 
86
 
 
87
=back
 
88
 
 
89
Normally you will use the plain C<exit()> in your code. You don't need
 
90
to use C<ModPerl::Util::exit> explicitly, since mod_perl overrides
 
91
C<exit()> by setting C<CORE::GLOBAL::exit> to
 
92
C<ModPerl::Util::exit>. Only if you redefine C<CORE::GLOBAL::exit>
 
93
once mod_perl is running, you may want to use this function.
 
94
 
 
95
The original C<exit()> is still available via C<CORE::exit()>.
 
96
 
 
97
C<ModPerl::Util::exit> is implemented as a special C<die()> call,
 
98
therefore if you call it inside C<eval BLOCK> or C<eval "STRING">,
 
99
while an exception is being thrown, it is caught by C<eval>. For
 
100
example:
 
101
 
 
102
  exit;
 
103
  print "Still running";
 
104
 
 
105
will not print anything. But:
 
106
 
 
107
  eval {
 
108
     exit;
 
109
  }
 
110
  print "Still running";
 
111
 
 
112
will print I<Still running>. So you either need to check whether L<the
 
113
exception|docs::2.0::api::APR::Error> is specific to C<exit> and call
 
114
C<exit()> again:
 
115
 
 
116
  use ModPerl::Const -compile => 'EXIT';
 
117
  eval {
 
118
     exit;
 
119
  }
 
120
  exit if $@ && ref $@ eq 'APR::Error' && $@ == ModPerl::EXIT;
 
121
  print "Still running";
 
122
 
 
123
or use C<CORE::exit()>:
 
124
 
 
125
  eval {
 
126
     CORE::exit;
 
127
  }
 
128
  print "Still running";
 
129
 
 
130
and nothing will be printed. The problem with the latter is the
 
131
current process (or a Perl Interpreter) will be killed; something that
 
132
you really want to avoid under mod_perl.
 
133
 
 
134
 
 
135
=head1 See Also
 
136
 
 
137
L<mod_perl 2.0 documentation|docs::2.0::index>.
 
138
 
 
139
 
 
140
 
 
141
 
 
142
=head1 Copyright
 
143
 
 
144
mod_perl 2.0 and its core modules are copyrighted under
 
145
The Apache Software License, Version 1.1.
 
146
 
 
147
 
 
148
 
 
149
 
 
150
=head1 Authors
 
151
 
 
152
L<The mod_perl development team and numerous
 
153
contributors|about::contributors::people>.
33
154
 
34
155
=cut
 
156