1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
? my $ctx = $main::context;
? $_mt->wrapper_file("wrapper.mt", "Configure", "Mruby Directives")->(sub {
<p>
The following are the configuration directives of the mruby handler.
Please refer to <a href="configure/mruby.html">Using mruby</a> to find out how to write handlers using mruby.
</p>
<?
$ctx->{directive}->(
name => "mruby.handler",
levels => [ qw(path) ],
see_also => render_mt(<<'EOT'),
<a href="configure/mruby_directives.html#mruby.handler-file"><code>mruby.handler-file</code></a>
EOT
desc => <<'EOT',
Upon start-up evaluates given mruby expression, and uses the returned mruby object to handle the incoming requests.
EOT
)->(sub {
?>
<?= $ctx->{example}->('Hello-world in mruby', <<'EOT')
mruby.handler: |
Proc.new do |env|
[200, {'content-type' => 'text/plain'}, ["Hello world\n"]]
end
EOT
?>
<p>
Note that the provided expression is evaluated more than once (typically for every thread that accepts incoming connections).
</p>
? })
<?
$ctx->{directive}->(
name => "mruby.handler-file",
levels => [ qw(path) ],
see_also => render_mt(<<'EOT'),
<a href="configure/mruby_directives.html#mruby.handler"><code>mruby.handler</code></a>
EOT
desc => <<'EOT',
Upon start-up evaluates given mruby file, and uses the returned mruby object to handle the incoming requests.
EOT
)->(sub {
?>
<?= $ctx->{example}->('Hello-world in mruby', <<'EOT')
mruby.handler-file: /path/to/my-mruby-handler.rb
EOT
?>
<p>
Note that the provided expression is evaluated more than once (typically for every thread that accepts incoming connections).
</p>
? })
? })
|