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

Diff of /trunk/lib/Strix/View.pm

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

revision 23 by dpavlin, Sun Jun 29 16:24:41 2008 UTC revision 32 by dpavlin, Sun Jun 29 20:52:33 2008 UTC
# Line 7  use Template::Declare::Tags; # defaults Line 7  use Template::Declare::Tags; # defaults
7  use base 'Template::Declare';  use base 'Template::Declare';
8  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
9    
10    =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  template 'show-user' => sub {  template 'show-user' => sub {
40          my ( $self, $req, $user ) = @_;          my ( $self, $req, $user ) = @_;
41          pre {          table {
42                  { class is 'debug' };                  foreach my $f ( keys %$user ) {
43                  outs( dump( $user ) );                          row {
44                                    cell { $f }
45                                    cell { $user->{$f} }
46                            }
47                    }
48          }          }
49  };  };
50    

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

  ViewVC Help
Powered by ViewVC 1.1.26