0
|
1 package Engine;
|
|
2 our $Encoding;
|
|
3
|
|
4 package Engine::Output::Page;
|
|
5 use strict;
|
|
6
|
|
7 use Common;
|
|
8 use DOM;
|
|
9
|
|
10 sub Print {
|
|
11 my ($class,$Query,$Action) = @_;
|
|
12
|
|
13 if (DOM::Site->can('LoadPage')) {
|
|
14 my $pageId = $Action->RequestURI->path;
|
|
15 DOM::Site->RegisterObject("Request",$Action);
|
|
16 my $Page = DOM::Site->LoadPage($pageId);
|
|
17 print $Query->header(-status => 200);
|
|
18 undef $@;
|
|
19 eval {
|
|
20 $Page->Properties->{Encoding} = $Engine::Encoding;
|
|
21 $Page->Render(*STDOUT);
|
|
22 };
|
|
23 if ($@) {
|
|
24 print $Query->start_html('Error processing template');
|
|
25 print $Query->p("Page: $pageId");
|
|
26 print $Query->p("Error: $@");
|
|
27 print $Query->end_html;
|
|
28 }
|
|
29 } else {
|
|
30 die new Exception('The site doesn\'t support page output');
|
|
31 }
|
|
32 }
|
|
33
|
|
34 1;
|