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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 26 - (hide annotations)
Sun Jun 29 18:08:50 2008 UTC (15 years, 10 months ago) by dpavlin
File size: 1044 byte(s)
another refacture and version bump [0.02]
- added support for error pages
- added list of classes
1 dpavlin 21 package Frey::View;
2 dpavlin 2
3     use strict;
4     use warnings;
5    
6     use Template::Declare::Tags; # defaults to 'HTML'
7 dpavlin 26 use Frey;
8     use base qw/Template::Declare/;
9 dpavlin 2 use Data::Dump qw/dump/;
10 dpavlin 26 use Carp qw/carp/;
11 dpavlin 2
12 dpavlin 26 sub debug_dump {
13     my $dump = dump( @_ );
14     carp "debug_dump $dump\n";
15     pre {
16     { class is 'debug' }
17     outs $dump;
18     }
19     }
20    
21     template 'status' => sub {
22 dpavlin 19 my ( $self ) = @_;
23     p { 'Welcome to Frey' }
24 dpavlin 26 show( 'templates' );
25     show( 'classes' );
26     };
27    
28     template 'templates' => sub {
29 dpavlin 23 h1 { 'Available templates' };
30     my $templates = Template::Declare->templates;
31 dpavlin 26 debug_dump( $templates );
32 dpavlin 23 ul {
33     foreach my $pkg ( keys %$templates ) {
34     li {
35     outs $pkg;
36     ul {
37     foreach my $template ( @{ $templates->{$pkg} } ) {
38     li {
39     a {
40     { href is "/$pkg/$template" }
41     $template
42     }
43     }
44     }
45     }
46     }
47     }
48     }
49 dpavlin 2 };
50    
51 dpavlin 26 template 'classes' => sub {
52     my $self = shift;
53     h1 { 'All classes in image' };
54     my $f = Frey->new;
55     debug_dump( $f->classes );
56 dpavlin 23 };
57    
58 dpavlin 26 template 'error' => sub {
59     my $self = shift;
60     p {
61     { class is 'error' }
62     outs( @_ );
63     }
64     };
65    
66 dpavlin 2 1;

  ViewVC Help
Powered by ViewVC 1.1.26