File: handler.pl

package info (click to toggle)
libhtml-mason-perl 1%3A1.26-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,636 kB
  • ctags: 1,260
  • sloc: perl: 13,880; sh: 154; makefile: 47
file content (39 lines) | stat: -rwxr-xr-x 761 bytes parent folder | download
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
#!/usr/bin/perl
#
# A basic, fuctional Mason handler.pl.
#
package MyApp::Mason;

# Bring in Mason with Apache support.
use HTML::Mason::ApacheHandler;
use strict;

# List of modules that you want to use within components.
{ package HTML::Mason::Commands;
  use Data::Dumper;
}

# Create ApacheHandler object at startup.
my $ah = new HTML::Mason::ApacheHandler( comp_root => '<component root>',
                                         data_dir => '<data directory>' );

sub handler
{
    my ($r) = @_;

    my $status = $ah->handle_request($r);
    return $status;
}

1;


__END__

In your httpd.conf, add something like this:

 PerlRequire /path/to/handler.pl
 <LocationMatch "\.html$">
   SetHandler perl-script
   PerlHandler MyApp::Mason
 </LocationMatch>