/[Frey]/trunk/lib/Frey/HTML.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Frey/HTML.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 26 by dpavlin, Sun Jun 29 18:08:50 2008 UTC revision 38 by dpavlin, Mon Jun 30 20:02:08 2008 UTC
# Line 19  Frey::HTML - generate html pages Line 19  Frey::HTML - generate html pages
19    
20  our @view_classes = qw(  our @view_classes = qw(
21          Frey::View          Frey::View
         Frey::REST  
22          Strix::View          Strix::View
23  );  );
24    
# Line 41  use Template::Declare; Line 40  use Template::Declare;
40  use Template::Declare::Tags; # defaults to 'HTML'  use Template::Declare::Tags; # defaults to 'HTML'
41  Template::Declare->init( roots => \@view_classes, around_template => sub {  Template::Declare->init( roots => \@view_classes, around_template => sub {
42          my ($orig, $path, $args, $code) = @_;          my ($orig, $path, $args, $code) = @_;
43            my $from = (caller(1))[3];
44            my $package = __PACKAGE__;
45            if ( $from !~ m/$package/ ) {
46                    warn "SKIP around_template for $path from $from\n";
47                    return $orig->();
48            } else {
49                    warn "WRAP around_temolate for $path from $from\n";
50            }
51    
52          my $t = time;          my $t = time;
53          html {          html {
54                  head {                  head {
# Line 56  Template::Declare->init( roots => \@view Line 64  Template::Declare->init( roots => \@view
64                                          { type is 'text/javascript' }                                          { type is 'text/javascript' }
65                                          { src is "/$js" }                                          { src is "/$js" }
66                                  }                                  }
67                          }                          };
68                  }                  }
69                  body {                  body {
70                          $orig->();                          $orig->();
# Line 74  Wrap template into html page Line 82  Wrap template into html page
82  =cut  =cut
83    
84  sub page {  sub page {
85          my $self = shift;          my ( $self, $page, $req, $args ) = @_;
86          warn "## page $_[0]\n";          warn "## page $page ",dump($args),"\n";
87          my $page = eval { Template::Declare->show( @_ ) };          my $out = eval { Template::Declare->show( $page, $req, $args ) };
88          if ( $@ ) {          if ( $@ ) {
89                  carp "ERROR: $@";                  carp "ERROR: $@";
90                  $page = Template::Declare->show( 'error', $@ );                  $out = Template::Declare->show( 'error', $req, "page $page " . dump($args) . ": $@" );
91          }          }
92          return $page;          return $out;
93  }  }
94    
95  =head2 add_javascript  =head2 add_javascript

Legend:
Removed from v.26  
changed lines
  Added in v.38

  ViewVC Help
Powered by ViewVC 1.1.26