Apache-AxKit-Provider-CGI
view release on metacpan or search on metacpan
package Apache::AxKit::Provider::CGI;
use 5.008;
use strict;
use warnings;
require Exporter;
#our @ISA = qw(Exporter);
our @ISA = ('Apache::AxKit::Provider::File');
our %EXPORT_TAGS = ( 'all' => [ qw() ] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw();
our $VERSION = '0.02';
use Apache;
use Apache::Log;
use Apache::AxKit::Exception;
use Apache::AxKit::Provider;
use Apache::AxKit::Provider::File;
use AxKit;
use Apache::Constants;
use File::Basename;
use XML::Simple;
# copied mostly from Filter provider...
sub get_fh {
my $self = shift;
throw Apache::AxKit::Exception::IO(-text => "Can't get fh for CGI filehandle");
}
sub get_strref {
my $self = shift;
require $self->{file};
my ($response, $stylesheet) = content();
delete $INC{$self->{file}};
my $xml = ($stylesheet ? "<?xml-stylesheet href=\"$stylesheet\" type=\"text/xsl\" ?>\n" : '');
$xml .= XML::Simple::XMLout($response, 'keyattr'=>[], 'rootname'=>'response', 'noattr'=>1);
return \$xml;
}
sub process {
my $self = shift;
my $xmlfile = $self->{file};
local $^W;
# always process this resource.
chdir(dirname($xmlfile));
return 1;
}
sub exists {
my $self = shift;
return 1;
}
sub has_changed () { 1; }
sub mtime {
my $self = shift;
return time(); # always fresh
}
1;
__END__
=head1 NAME
Apache::AxKit::Provider::CGI - CGI generated XML content without Taglibs
=head1 SYNOPSIS
Apache::AxKit::Provider::CGI is an AxKit Content Provider.
If you have a working instance of AxKit, you can use
Apache::AxKit::Provider::CGI by adding the following directive to
your httpd.conf file:
AxContentProvider Apache::AxKit::Provider::CGI
=head1 ABSTRACT
AxKit has a very powerful Taglib architecture that allows you to
separate you content from your presentation.
This module provides an alternative to taglibs. The general philosphy
( run in 0.665 second using v1.01-cache-2.11-cpan-39bf76dae61 )