view Lib/Engine/Output/Page.pm @ 144:b56ebc31bf18

Empty nodes no more created while transforming a post request to the DOM document minor speed improvements to the object CTOR caching Added support for a secure processing (and 'laundering' ) a CGI parameters Many minor fixes
author wizard
date Tue, 13 Jul 2010 02:05:38 +0400
parents 16ada169ca75
children
line wrap: on
line source

package Engine;
our $Encoding;

package Engine::Output::Page;
use strict;

use Common;
use DOM;

sub Print {
    my ($class,$Query,$Action) = @_;
    
    if (DOM::Site->can('LoadPage')) {
        my $pageId = $Action->RequestURI->path;
        DOM::Site->RegisterObject("Request",$Action);
        my $Page = DOM::Site->LoadPage($pageId);
        print $Query->header(-status => 200);
        undef $@;
        eval {
            $Page->Properties->{Encoding} = $Engine::Encoding;
            $Page->Render(*STDOUT);
        };
        if ($@) {
            print $Query->start_html('Error processing template');
            print $Query->p("Page: $pageId");
            print $Query->p("Error: $@");
            print $Query->end_html;
        }
    } else {
        die new Exception('The site doesn\'t support page output');
    }
}

1;