13 |
|
|
14 |
use lib 'lib'; |
use lib 'lib'; |
15 |
|
|
16 |
extends 'Frey::ClassLoader'; |
extends 'Frey::PPI'; |
17 |
with 'Frey::Web'; |
with 'Frey::Web'; |
18 |
|
|
19 |
has 'class' => ( |
has 'class' => ( |
22 |
required => 1, |
required => 1, |
23 |
); |
); |
24 |
|
|
|
has 'path' => ( |
|
|
is => 'rw', |
|
|
); |
|
|
|
|
25 |
=head2 joose |
=head2 joose |
26 |
|
|
27 |
my $js = $o->joose; |
my $js = $o->joose; |
94 |
my $path = "static/blib/$filename"; |
my $path = "static/blib/$filename"; |
95 |
write_file( $path, $out ); |
write_file( $path, $out ); |
96 |
warn "# created $path\n"; |
warn "# created $path\n"; |
|
$self->path( $path ); |
|
97 |
|
|
98 |
return $out; |
return $out; |
99 |
} |
} |
100 |
|
|
101 |
=head1 OUTPUT GENERATION |
sub as_markup { |
|
|
|
|
=head2 markup |
|
|
|
|
|
$o->markup; |
|
|
|
|
|
=cut |
|
|
|
|
|
sub markup { |
|
102 |
my ( $self ) = @_; |
my ( $self ) = @_; |
103 |
|
|
104 |
$self->add_head( 'static/introspect.css' ); |
$self->add_head( 'static/introspect.css' ); |
198 |
} |
} |
199 |
$table .= qq|</table>|; |
$table .= qq|</table>|; |
200 |
|
|
201 |
my $pod = Frey::Pod->new( class => $class )->markup; |
my $pod = Frey::Pod->new( class => $class )->as_markup; |
202 |
$pod = $pod->{body} if ref($pod); |
$pod = $pod->{body} if ref($pod); |
203 |
|
|
204 |
my $path = $self->class_path( $class ); |
my $path = $self->class_path( $class ); |
223 |
# $source =~ s{^.*<body[^>]+>}{}s; |
# $source =~ s{^.*<body[^>]+>}{}s; |
224 |
# $source =~ s{</body.*$}{}s; |
# $source =~ s{</body.*$}{}s; |
225 |
|
|
|
|
|
|
use Frey::Run; |
|
|
my $class_method = $self->class_methods( $class ); |
|
226 |
my $runnable = join("\n", |
my $runnable = join("\n", |
227 |
map { $class_method->{$_} ? qq|<a href="/$class/$_">$_</a>| : '' } grep { $class->can($_) } Frey::Run->runnable |
map { |
228 |
|
qq|<a target="$class" href="/$class/$_">$_</a>| |
229 |
|
} $self->class_runnable( $class ) |
230 |
); |
); |
231 |
$runnable = " runnable: $runnable" if $runnable; |
$runnable = " runnable: $runnable" if $runnable; |
232 |
|
|
233 |
my $html = { |
$self->title( $class ); |
|
title => $class, |
|
|
body => join("\n", |
|
|
qq|<h1>$class</h1>|, |
|
|
qq|<div class="frey-introspect">$superclasses\n$roles\n$runnable\n|, |
|
|
$pod ? qq|<a class="frey-skip" href="#___top" title="Skip to POD" >pod</a>| : '', |
|
|
$source ? qq|<a class="frey-skip" href="#source" title="Skip to source" >source</a>| : '', |
|
|
qq|$table\n$pod\n</div>\n|, |
|
|
qq|<h1>Source</h1><a name="source"></a><div class="frey-source">$source</div>|, |
|
|
), |
|
|
}; |
|
234 |
|
|
235 |
return $html; |
my $has_tests = ''; |
236 |
|
if ( my @tests = $self->has_tests ) { |
237 |
|
$has_tests = |
238 |
|
'<br/>test' . ( $#tests > 0 ? 's' : '' ) . ': ' . |
239 |
|
join("\n", map { |
240 |
|
qq|<a target="$class" href="/Frey::Test::Runner/as_markup?test=$_">$_</a>| |
241 |
|
} @tests ); |
242 |
|
} |
243 |
|
|
244 |
|
return join("\n", |
245 |
|
qq|<h1>$class</h1>|, |
246 |
|
qq|<div class="frey-introspect">$superclasses\n$roles\n$runnable\n|, |
247 |
|
$pod ? qq|<a class="frey-skip" href="#___top" title="Skip to POD" >pod</a>| : '', |
248 |
|
$source ? qq|<a class="frey-skip" href="#source" title="Skip to source" >source</a>| : '', |
249 |
|
$has_tests, |
250 |
|
qq|$table\n$pod\n</div>\n|, |
251 |
|
qq|<h1>Source</h1><a name="source"></a><div class="frey-source">$source</div>|, |
252 |
|
); |
253 |
} |
} |
254 |
|
|
255 |
=head1 SEE ALSO |
=head1 SEE ALSO |