/[Frey]/trunk/lib/Frey/ClassBrowser.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

Contents of /trunk/lib/Frey/ClassBrowser.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 409 - (show annotations)
Tue Nov 18 13:52:26 2008 UTC (15 years, 5 months ago) by dpavlin
File size: 1147 byte(s)
class_methods can now return hash for easy check of defined methods
1 package Frey::ClassBrowser;
2 use Moose;
3
4 extends 'Frey::ClassLoader';
5
6 use Frey::Run;
7
8 our $markup;
9
10 sub markup {
11 my $self = shift;
12 return $markup if $markup;
13 my $html;
14 foreach my $class ( $self->classes ) {
15 $html .= qq|<tr><td><a href="/$class" title="| . $self->class_path( $class ) . qq|">$class</a></td><td>|;
16 if ( $class->can('meta') ) {
17 if ( $class->meta->isa('Moose::Meta::Role') ) {
18 $html .= qq|role|;
19 } else {
20 $html .= qq|<a href="/Frey-ObjectDesigner?class=$class">design</a>| if $class->can('collection');
21 }
22 }
23 my @run;
24 my @input;
25 push @run, qq|<a href="/Frey-ObjectBrowser?class=$class">collection</a>| if $class->can('collection_table');
26 my $class_method = $self->class_methods( $class );
27 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;
40 $markup = $html;
41 }
42
43 1;

  ViewVC Help
Powered by ViewVC 1.1.26