File Coverage

blib/lib/Bryar/Frontend/Mod_perl.pm
Criterion Covered Total %
statement 24 40 60.0
branch 0 2 0.0
condition 0 3 0.0
subroutine 8 15 53.3
pod 6 7 85.7
total 38 67 56.7


line stmt bran cond sub pod time code
1             package Bryar::Frontend::Mod_perl;
2 1     1   744 use base 'Bryar::Frontend::Base';
  1         2  
  1         487  
3 1     1   332 use Apache::Constants qw(OK);
  1         124  
  1         62  
4 1     1   262 use Apache::Request;
  1         38  
  1         21  
5 1     1   316 use Apache;
  1         45  
  1         27  
6 1     1   25 use 5.006;
  1         4  
  1         28  
7 1     1   4 use strict;
  1         1  
  1         20  
8 1     1   4 use warnings;
  1         1  
  1         26  
9 1     1   5 use Carp;
  1         1  
  1         354  
10             our $VERSION = '1.1';
11              
12             =head1 NAME
13              
14             Bryar::Frontend::Mod_perl - Apache mod_perl interface to Bryar
15              
16             =head1 DESCRIPTION
17              
18             This is a frontend to Bryar which is used when Bryar is being driven
19             from Apache.
20              
21             =cut
22              
23 0     0 1   sub obtain_url { Apache->request->uri() }
24 0     0 1   sub obtain_path_info { Apache->request->path_info() }
25 0     0 1   sub obtain_params { my $apr = Apache::Request->new(Apache->request);
26 0           map { $_ => $apr->param($_) } $apr->param ;
  0            
27             }
28 0     0 1   sub send_data { my $self = shift;
29 0           Apache->request->send_http_header("text/html");
30 0           Apache->request->status(OK);
31 0           Apache->request->print(@_);
32             }
33             sub send_header {
34 0     0 1   my ($self, $k, $v) = @_; Apache->request->header_out($k, $v) }
  0            
35              
36             sub get_header {
37 0     0 1   my ($self, $header) = @_;
38 0           Apache->request->headers_in->get($header);
39             }
40              
41             sub handler ($$) {
42 0     0 0   my ($class, $r)= @_;
43 0 0 0       return -1 if$r->filename and -f $r->filename;
44 0           Bryar->go(datadir => $r->dir_config('BryarDataDir'),
45             baseurl => $r->dir_config('BryarBaseURL'));
46             }
47              
48              
49             1;
50              
51             =head1 LICENSE
52              
53             This module is free software, and may be distributed under the same
54             terms as Perl itself.
55              
56             =head1 AUTHOR
57              
58             Copyright (C) 2003, Simon Cozens C