--- trunk/lib/Frey/View.pm 2008/07/05 15:08:51 52 +++ trunk/lib/Frey/View.pm 2008/07/05 15:19:55 53 @@ -22,7 +22,8 @@ my ( $self ) = @_; p { 'Welcome to Frey' }; show( 'templates' ); - show( 'classes' ); + show( 'packages' ); + show( 'introspect' ); }; sub method_link { @@ -41,12 +42,12 @@ outs $pkg; ul { foreach my $method ( @{ $methods } ) { - li { method_link( $pkg, $method ) } + li { method_link( "crud/$pkg", $method ) } } } } -template 'package-methods' => sub { +template 'package-templates' => sub { my ( $self, $req, $package ) = @_; $package ||= $req->param('package'); my $methods = Template::Declare->templates->{ $package } or die "no package $package\n"; @@ -67,13 +68,43 @@ } }; -template 'classes' => sub { +template 'packages' => sub { my $self = shift; h1 { 'All packages in image' }; my $f = Frey->new; debug_dump( $f->classes ); }; +use Frey::Introspect; + +template 'introspect' => sub { + my $self = shift; + h1 { 'Introspect Moose packages' }; + ul { + map { + my ( $package, $path ) = each( %$_ ); + li { + outs $package; + my $f = Frey::Introspect->new( package => $package ); + my ( $class, $meta, $is_role ) = $f->load_package(); + if ( $class->can('meta') ) { + ul { + foreach my $m ( $f->methods ) { + li { method_link( $package, $m ) } + } + } + pre { + { class is 'debug' }; + outs $class->dump( 1 ); + } + } else { + b { "not introspectable" } + } + } + } @{ Frey->new->classes }; + } +}; + template 'error' => sub { my ( $self, $req, $error ) = @_; $error ||= dump( caller(1) );