/[Frey]/trunk/lib/Frey/View.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

Contents of /trunk/lib/Frey/View.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 23 - (show annotations)
Sun Jun 29 16:24:41 2008 UTC (14 years, 5 months ago) by dpavlin
File size: 776 byte(s)
another major refactor and version bump [0.01]

- return 404 errors for resources which doesn't exist
- move HTML page wrapper is now in Fray::HTML->page
- dispatch to defined Template::Declare templates
- display available templates on status screen
- NOTE very clean and unobfuscated mapping
- a bits of documentation all over the place
1 package Frey::View;
2
3 use strict;
4 use warnings;
5
6 use Template::Declare::Tags; # defaults to 'HTML'
7 use base 'Template::Declare';
8 use Data::Dump qw/dump/;
9
10 template status => sub {
11 my ( $self ) = @_;
12 p { 'Welcome to Frey' }
13 h1 { 'Available templates' };
14 my $templates = Template::Declare->templates;
15 warn "templates = ",dump( $templates );
16 ul {
17 foreach my $pkg ( keys %$templates ) {
18 li {
19 outs $pkg;
20 ul {
21 foreach my $template ( @{ $templates->{$pkg} } ) {
22 li {
23 a {
24 { href is "/$pkg/$template" }
25 $template
26 }
27 }
28 }
29 }
30 }
31 }
32 }
33 pre {
34 { class is 'debug' }
35 outs dump( Template::Declare->templates )
36 }
37 };
38
39 template 'refresh_modules' => sub {
40 Module::Refresh->refresh;
41 p { 'Modules refreshed' }
42 };
43
44 1;

  ViewVC Help
Powered by ViewVC 1.1.26