File Coverage

blib/lib/Apache/AxKit/Provider/CGI.pm
Criterion Covered Total %
statement 10 12 83.3
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 16 87.5


line stmt bran cond sub pod time code
1             package Apache::AxKit::Provider::CGI;
2              
3 1     1   22321 use 5.008;
  1         4  
  1         55  
4 1     1   5 use strict;
  1         2  
  1         38  
5 1     1   5 use warnings;
  1         5  
  1         125  
6              
7             require Exporter;
8              
9             #our @ISA = qw(Exporter);
10             our @ISA = ('Apache::AxKit::Provider::File');
11              
12             our %EXPORT_TAGS = ( 'all' => [ qw() ] );
13             our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
14             our @EXPORT = qw();
15              
16             our $VERSION = '0.02';
17              
18 1     1   452 use Apache;
  0            
  0            
19             use Apache::Log;
20             use Apache::AxKit::Exception;
21             use Apache::AxKit::Provider;
22             use Apache::AxKit::Provider::File;
23             use AxKit;
24             use Apache::Constants;
25             use File::Basename;
26             use XML::Simple;
27              
28             # copied mostly from Filter provider...
29             sub get_fh {
30             my $self = shift;
31             throw Apache::AxKit::Exception::IO(-text => "Can't get fh for CGI filehandle");
32             }
33              
34             sub get_strref {
35             my $self = shift;
36             require $self->{file};
37             my ($response, $stylesheet) = content();
38             delete $INC{$self->{file}};
39              
40             my $xml = ($stylesheet ? "\n" : '');
41             $xml .= XML::Simple::XMLout($response, 'keyattr'=>[], 'rootname'=>'response', 'noattr'=>1);
42              
43             return \$xml;
44             }
45              
46             sub process {
47             my $self = shift;
48              
49             my $xmlfile = $self->{file};
50              
51             local $^W;
52             # always process this resource.
53             chdir(dirname($xmlfile));
54             return 1;
55             }
56              
57             sub exists {
58             my $self = shift;
59             return 1;
60             }
61              
62             sub has_changed () { 1; }
63              
64             sub mtime {
65             my $self = shift;
66             return time(); # always fresh
67             }
68              
69             1;
70             __END__