matts 2003/02/05 08:29:47
Added: lib/Apache/AxKit/Language Petal.pm Log: Start of a Petal Language module. This is broken though - so don't try it yet ;-) Revision Changes Path 1.1 xml-axkit/lib/Apache/AxKit/Language/Petal.pm Index: Petal.pm =================================================================== # $Id: Petal.pm,v 1.1 2003/02/05 16:29:47 matts Exp $ package Apache::AxKit::Language::Petal; use strict; use vars qw/@ISA $VERSION/; use Petal; use Apache; use Apache::Request; use Apache::AxKit::Language; use Apache::AxKit::Provider; use XML::Simple; @ISA = 'Apache::AxKit::Language'; $VERSION = 1.0; # this fixes a CPAN.pm bug. Bah! sub handler { my $class = shift; my ($r, $xml, $style, $last_in_chain) = @_; my $xmlstring; AxKit::Debug(7, "[Petal] getting the XML"); if (my $dom = $r->pnotes('dom_tree')) { $xmlstring = $dom->toString; delete $r->pnotes()->{'dom_tree'}; } else { $xmlstring = $r->pnotes('xml_string'); } # Setup petal variables local $Petal::INPUT = 'XML'; local $Petal::OUTPUT = $last_in_chain ? 'XHTML' : 'XML'; local $Petal::DISK_CACHE = 1; local $Petal::MEMORY_CACHE = 1; AxKit::Debug(7, "[Petal] parsing stylesheet"); my $stylesheet = Petal->new(file => ugh); AxKit::Debug(7, "[Petal] parsing input"); my $hash = XMLin($xmlstring, forcearray => 1); AxKit::Debug(7, "[Petal] performing transformation"); $r->print( $stylesheet->process($hash) ); return Apache::Constants::OK; } 1;