/[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

trunk/lib/HTML.pm revision 21 by dpavlin, Sun Jun 29 13:12:59 2008 UTC trunk/lib/Frey/HTML.pm revision 23 by dpavlin, Sun Jun 29 16:24:41 2008 UTC
# Line 1  Line 1 
1  package HTML;  package Frey::HTML;
2    
3  use strict;  use strict;
4  use warnings;  use warnings;
# Line 7  use Time::HiRes qw/time/; Line 7  use Time::HiRes qw/time/;
7  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
8  use Carp qw/confess/;  use Carp qw/confess/;
9    
10    =head1 NAME
11    
12    Frey::HTML - generate html pages
13    
14    =head2 METHODS
15    
16    =cut
17    
18  # FIXME  # FIXME
19    
20  our @view_classes = qw(  our @view_classes = qw(
# Line 27  foreach ( @view_classes ) { Line 35  foreach ( @view_classes ) {
35  warn "available templates = ",dump( Template::Declare->templates );  warn "available templates = ",dump( Template::Declare->templates );
36    
37  our @javascript;  our @javascript;
38    our $debug = 0;
39    
40  use Template::Declare;  use Template::Declare;
41  use Template::Declare::Tags; # defaults to 'HTML'  use Template::Declare::Tags; # defaults to 'HTML'
# Line 52  Template::Declare->init( roots => \@view Line 61  Template::Declare->init( roots => \@view
61                  body {                  body {
62                          $orig->();                          $orig->();
63                  }                  }
64          }          };
65          warn "TEMPLATE $path ",dump($args),sprintf(" in %.4fs\n",time - $t);          warn "TEMPLATE $path ",dump($args),sprintf(" in %.4fs\n",time - $t) if $debug;
66  });  });
67    
68  sub view {  =head2 page
69    
70    Wrap template into html page
71    
72      Frey::HTML->page( 'template_name', $req, $args );
73    
74    =cut
75    
76    sub page {
77          my $self = shift;          my $self = shift;
78            warn "## page $_[0]\n";
79          return Template::Declare->show( @_ );          return Template::Declare->show( @_ );
80  }  }
81    
82    =head2 add_javascript
83    
84    Add javascript to current page
85    
86      Frey::HTML->add_javascript( 'static/javascript.js' );
87    
88    =cut
89    
90  sub add_javascript {  sub add_javascript {
91          my $self = shift;          my $self = shift;
92          my $js = shift or confess "no JavaScript path";          my $js = shift or confess "no JavaScript path";

Legend:
Removed from v.21  
changed lines
  Added in v.23

  ViewVC Help
Powered by ViewVC 1.1.26