1 |
package Frey::ClassBrowser; |
2 |
use Moose; |
3 |
|
4 |
extends 'Frey'; |
5 |
|
6 |
use Frey::ClassLoader; |
7 |
|
8 |
our $markup; |
9 |
|
10 |
sub markup { |
11 |
return $markup if $markup; |
12 |
my $f = Frey::ClassLoader->new; |
13 |
my $html; |
14 |
foreach my $package ( $f->classes ) { |
15 |
$html .= qq|<tr><td><a href="/~/$package" title="| . $f->package_path( $package ) . qq|">$package</a></td><td>|; |
16 |
if ( $package->can('meta') ) { |
17 |
if ( $package->meta->isa('Moose::Meta::Role') ) { |
18 |
$html .= qq|role|; |
19 |
} else { |
20 |
$html .= qq|<a href="/od/$package">design</a>| if $package->can('collection'); |
21 |
} |
22 |
} |
23 |
my @inspect; |
24 |
push @inspect, qq|<a href="/ob/$package">collection</a>| if $package->can('collection_table'); |
25 |
push @inspect, qq|<a href="/markup/$package">markup</a>| if $package->can('markup'); |
26 |
push @inspect, qq|<a href="/request/$package">request</a>| if $package->can('request'); |
27 |
$html .= qq|</td><td>| . join(' ', @inspect) . qq|</td></tr>|; |
28 |
} |
29 |
$html = "<table>$html</table>" if $html; |
30 |
$markup = $html; |
31 |
} |
32 |
|
33 |
1; |