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

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

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

revision 52 by dpavlin, Mon Jun 30 20:02:14 2008 UTC revision 53 by dpavlin, Sat Jul 5 15:19:55 2008 UTC
# Line 22  template 'status' => sub { Line 22  template 'status' => sub {
22          my ( $self ) = @_;          my ( $self ) = @_;
23          p { 'Welcome to Frey' };          p { 'Welcome to Frey' };
24          show( 'templates' );          show( 'templates' );
25          show( 'classes' );          show( 'packages' );
26            show( 'introspect' );
27  };  };
28    
29  sub method_link {  sub method_link {
# Line 41  sub package_methods { Line 42  sub package_methods {
42          outs $pkg;          outs $pkg;
43          ul {          ul {
44                  foreach my $method ( @{ $methods } ) {                  foreach my $method ( @{ $methods } ) {
45                          li { method_link( $pkg, $method ) }                          li { method_link( "crud/$pkg", $method ) }
46                  }                  }
47          }          }
48  }  }
49    
50  template 'package-methods' => sub {  template 'package-templates' => sub {
51          my ( $self, $req, $package ) = @_;          my ( $self, $req, $package ) = @_;
52          $package ||= $req->param('package');          $package ||= $req->param('package');
53          my $methods = Template::Declare->templates->{ $package } or die "no package $package\n";          my $methods = Template::Declare->templates->{ $package } or die "no package $package\n";
# Line 67  template 'templates' => sub { Line 68  template 'templates' => sub {
68          }          }
69  };  };
70    
71  template 'classes' => sub {  template 'packages' => sub {
72          my $self = shift;          my $self = shift;
73          h1 { 'All packages in image' };          h1 { 'All packages in image' };
74          my $f = Frey->new;          my $f = Frey->new;
75          debug_dump( $f->classes );          debug_dump( $f->classes );
76  };  };
77    
78    use Frey::Introspect;
79    
80    template 'introspect' => sub {
81            my $self = shift;
82            h1 { 'Introspect Moose packages' };
83            ul {
84                    map {
85                            my ( $package, $path ) = each( %$_ );
86                            li {
87                                    outs $package;
88                                    my $f = Frey::Introspect->new( package => $package );
89                                    my ( $class, $meta, $is_role ) = $f->load_package();
90                                    if ( $class->can('meta') ) {
91                                            ul {
92                                                    foreach my $m ( $f->methods ) {
93                                                            li { method_link( $package, $m ) }
94                                                    }
95                                            }
96                                            pre {
97                                                    { class is 'debug' };
98                                                    outs $class->dump( 1 );
99                                            }
100                                    } else {
101                                            b { "not introspectable" }
102                                    }
103                            }
104                    } @{ Frey->new->classes };
105            }
106    };
107    
108  template 'error' => sub {  template 'error' => sub {
109          my ( $self, $req, $error ) = @_;          my ( $self, $req, $error ) = @_;
110          $error ||= dump( caller(1) );          $error ||= dump( caller(1) );

Legend:
Removed from v.52  
changed lines
  Added in v.53

  ViewVC Help
Powered by ViewVC 1.1.26