--- trunk/lib/Frey/ClassBrowser.pm 2008/10/31 19:51:51 213
+++ trunk/lib/Frey/ClassBrowser.pm 2008/11/18 23:42:40 427
@@ -1,40 +1,49 @@
package Frey::ClassBrowser;
use Moose;
-extends 'Frey';
+extends 'Frey::ClassLoader';
with 'Frey::Web';
-use Frey::ClassLoader;
-
-our $markup;
+use Frey::Run;
sub markup {
- return $markup if $markup;
- my $f = Frey::ClassLoader->new;
- my $html;
- foreach my $package ( $f->classes ) {
- $html .= qq|
$package | |;
- if ( $package->can('meta') ) {
- if ( $package->meta->isa('Moose::Meta::Role') ) {
+ my $self = shift;
+ my @rows;
+ foreach my $class ( $self->classes ) {
+ my $html
+ = qq| |
$class | |
+ ;
+ if ( $class->can('meta') ) {
+ if ( $class->meta->isa('Moose::Meta::Role') ) {
$html .= qq|role|;
} else {
- $html .= qq|design| if $package->can('collection');
+ $html .= qq|design| if $class->can('collection');
+ }
+ }
+ my @run;
+ my @input;
+ push @run, qq|collection| if $class->can('collection_table');
+ my $class_method = $self->class_methods( $class );
+ foreach my $try ( Frey::Run->runnable ) {
+ next unless $class->can($try);
+ if ( $class_method->{ $try } ) {
+ push @run, qq|$try|;
+ } else {
+ push @input, $try;
}
}
- my @inspect;
- push @inspect, qq|collection| if $package->can('collection_table');
- push @inspect, qq|markup| if $package->can('markup');
- push @inspect, qq|request| if $package->can('request');
- $html .= qq| | | . join(' ', @inspect) . qq| |
|;
+ $html
+ .= qq||
+ . join(' ', @run)
+ . qq| | |
+ . ( @input ? '← ' . join(' ', @input) : '' )
+ . qq| | |
+ ;
+ push @rows, $html if $html;
}
- $html = "" if $html;
- $markup = $html;
-}
-
-sub request {
- my ( $self, $req ) = @_;
- my $html = $self->page( body => qq|Classes
| . $self->markup );
- $req->print( $html );
+ return qq|| . join("\n", @rows) . qq|
| if @rows;
}
1;