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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (hide annotations)
Sun Jun 29 20:52:33 2008 UTC (15 years, 10 months ago) by dpavlin
File size: 786 byte(s)
Remove Frey::REST and merge it into Strix::View

Various other fixes along the way...
1 dpavlin 19 package Strix::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 dpavlin 32 =head1 NAME
11    
12     Strix::View - examine Strix data
13    
14     =cut
15    
16     =head1 METHODS
17    
18     =head2 user
19    
20     =cut
21    
22     use Strix::User;
23    
24     template 'user' => sub {
25     my ( $self, $req ) = @_;
26     my $id = $req->param('id');
27    
28     my $user = eval { Strix::User->new( id => $id ); };
29     warn "## user $id: $@";
30    
31     if ( ! $user ) {
32     $req->conn->send_status_line( 404, "user $id" );
33     $req->print( "Can't find user with id $id\n$@" );
34     } else {
35     $req->print( show( 'show-user', $req, $user ) );
36     };
37     };
38    
39 dpavlin 23 template 'show-user' => sub {
40     my ( $self, $req, $user ) = @_;
41 dpavlin 32 table {
42     foreach my $f ( keys %$user ) {
43     row {
44     cell { $f }
45     cell { $user->{$f} }
46     }
47     }
48 dpavlin 19 }
49     };
50    
51     1;

  ViewVC Help
Powered by ViewVC 1.1.26