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

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

revision 213 by dpavlin, Fri Oct 31 19:51:51 2008 UTC revision 409 by dpavlin, Tue Nov 18 13:52:26 2008 UTC
# Line 1  Line 1 
1  package Frey::ClassBrowser;  package Frey::ClassBrowser;
2  use Moose;  use Moose;
3    
4  extends 'Frey';  extends 'Frey::ClassLoader';
 with 'Frey::Web';  
5    
6  use Frey::ClassLoader;  use Frey::Run;
7    
8  our $markup;  our $markup;
9    
10  sub markup {  sub markup {
11            my $self = shift;
12          return $markup if $markup;          return $markup if $markup;
         my $f = Frey::ClassLoader->new;  
13          my $html;          my $html;
14          foreach my $package ( $f->classes ) {          foreach my $class ( $self->classes ) {
15                  $html .= qq|<tr><td><a href="/~/$package" title="| . $f->package_path( $package ) . qq|">$package</a></td><td>|;                  $html .= qq|<tr><td><a href="/$class" title="| . $self->class_path( $class ) . qq|">$class</a></td><td>|;
16                  if ( $package->can('meta') ) {                  if ( $class->can('meta') ) {
17                          if ( $package->meta->isa('Moose::Meta::Role') ) {                          if ( $class->meta->isa('Moose::Meta::Role') ) {
18                                  $html .= qq|role|;                                  $html .= qq|role|;
19                          } else {                          } else {
20                                  $html .= qq|<a href="/od/$package">design</a>| if $package->can('collection');                                  $html .= qq|<a href="/Frey-ObjectDesigner?class=$class">design</a>| if $class->can('collection');
21                          }                          }
22                  }                  }
23                  my @inspect;                  my @run;
24                  push @inspect, qq|<a href="/ob/$package">collection</a>| if $package->can('collection_table');                  my @input;
25                  push @inspect, qq|<a href="/markup/$package">markup</a>| if $package->can('markup');                  push @run, qq|<a href="/Frey-ObjectBrowser?class=$class">collection</a>| if $class->can('collection_table');
26                  push @inspect, qq|<a href="/request/$package">request</a>| if $package->can('request');                  my $class_method = $self->class_methods( $class );
27                  $html .= qq|</td><td>| . join('&nbsp;', @inspect) . qq|</td></tr>|;                  foreach my $try ( Frey::Run->runnable ) {
28                            next unless $class->can($try);
29                            if ( $class_method->{ $try } ) {
30                                    push @run, qq|<a href="/$class/$try">$try</a>|;
31                            } else {
32                                    push @input, $try;
33                            }
34                    }
35                    $html .= qq|</td><td>| . join(' ', @run) . qq|</td><td>| .
36                            ( @input ? '&larr; ' . join(' ', @input) : '' ) .
37                            qq|</td></tr>|;
38          }          }
39          $html = "<table>$html</table>" if $html;          $html = "<table>$html</table>" if $html;
40          $markup = $html;          $markup = $html;
41  }  }
42    
 sub request {  
         my ( $self, $req ) = @_;  
         my $html = $self->page( body => qq|<h1>Classes</h1>| . $self->markup );  
         $req->print( $html );  
 }  
   
43  1;  1;

Legend:
Removed from v.213  
changed lines
  Added in v.409

  ViewVC Help
Powered by ViewVC 1.1.26