111 |
sub as_markup { |
sub as_markup { |
112 |
my ( $self ) = @_; |
my ( $self ) = @_; |
113 |
|
|
|
$self->add_head( 'static/introspect.css' ); |
|
|
|
|
114 |
my ( $meta, $is_role ) = $self->class_meta; |
my ( $meta, $is_role ) = $self->class_meta; |
115 |
|
|
116 |
my $class = $self->class; |
my $class = $self->class; |
146 |
$roles = join(' ', |
$roles = join(' ', |
147 |
grep { ! m/\Q$class\E/ } # skip me |
grep { ! m/\Q$class\E/ } # skip me |
148 |
map { |
map { |
149 |
my $name = $_->name; |
my $r = ''; |
150 |
$introspect->{roles}->{$name} = {}; |
foreach my $name ( split(/\|/, $_->name) ) { |
151 |
$method_from_role->{ $_ }->{$name} = $role_nr foreach $_->get_method_list; |
$introspect->{roles}->{$name} = {}; |
152 |
$attribute_from_role->{ $_ }->{$name} = $role_nr foreach $_->get_attribute_list; |
$method_from_role->{ $_ }->{$name} = $role_nr foreach $_->get_method_list; |
153 |
|
$attribute_from_role->{ $_ }->{$name} = $role_nr foreach $_->get_attribute_list; |
154 |
qq|<a target="$name" href="/$name" title="introspect $name">$name</a>| |
|
155 |
# . qq|<sup>| . $self->dropdown( $role_nr++, $name->meta ) . qq|</sup>| |
$r .= |
156 |
. $self->dropdown( |
qq|<a target="$name" href="/$name" title="introspect $name">$name</a>| |
157 |
qq|<sup>| . $role_nr++ . qq|</sup>|, |
# . qq|<sup>| . $self->dropdown( $role_nr++, $name->meta ) . qq|</sup>| |
158 |
$name->meta |
. $self->dropdown( |
159 |
) |
qq|<sup>| . $role_nr++ . qq|</sup>|, |
160 |
; |
$name->meta |
161 |
|
) |
162 |
|
; |
163 |
|
} |
164 |
|
$r; |
165 |
} |
} |
166 |
$meta->calculate_all_roles |
$meta->calculate_all_roles |
167 |
); |
); |
255 |
|
|
256 |
my $path = $self->class_path( $class ); |
my $path = $self->class_path( $class ); |
257 |
|
|
258 |
my $pod = Frey::Pod->new( class => $class, request_url => $self->request_url )->as_markup; |
my ( $pod_toc, $pod ) = Frey::Pod->new( class => $class, request_url => $self->request_url )->as_markup; |
259 |
return $pod if $path =~ m{\.pod}; |
return $pod_toc . $pod if $path =~ m{\.pod}; |
260 |
|
|
261 |
|
warn "# ", $pod_toc ? 'toc' : '', ' ', $pod ? 'pod' : ''; |
262 |
|
|
263 |
my $Document = PPI::Document->new( $path ); |
my $Document = PPI::Document->new( $path ); |
264 |
|
|
292 |
$runnable = "<dt>runnable</dt><dd>$runnable</dd>" if $runnable; |
$runnable = "<dt>runnable</dt><dd>$runnable</dd>" if $runnable; |
293 |
|
|
294 |
my $has_tests = ''; |
my $has_tests = ''; |
295 |
my @tests = grep { defined $_ } $self->has_tests; |
my @tests = sort { lc($a) cmp lc($b) } grep { defined $_ } $self->has_tests; |
296 |
if ( @tests ) { |
if ( @tests ) { |
297 |
$has_tests |
$has_tests |
298 |
= qq|<dt>test| |
= qq|<dt>test| |
327 |
$self->store( $introspect_path, $introspect ); |
$self->store( $introspect_path, $introspect ); |
328 |
|
|
329 |
$self->add_css(qq| |
$self->add_css(qq| |
330 |
.right { |
.frey-introspect-right { |
331 |
position: fixed; |
position: fixed; |
332 |
top: 1em; |
top: 1em; |
333 |
right: 1em; |
right: 1em; |
337 |
width: 20%; |
width: 20%; |
338 |
font-size: 80%; |
font-size: 80%; |
339 |
} |
} |
340 |
.right dl dd { |
.frey-introspect-right dl dd { |
341 |
margin-left: 1em; |
margin-left: 1em; |
342 |
} |
} |
343 |
|
|
344 |
|
/* fix pod */ |
345 |
|
.frey-introspect-right dd ul { |
346 |
|
padding-left: 0; |
347 |
|
} |
348 |
|
.frey-introspect-right dl ul > li { |
349 |
|
list-style: none; |
350 |
|
} |
351 |
|); |
|); |
352 |
|
|
353 |
my $right |
my $has_pod = qq| |
354 |
= qq| |
<dt><a href="#___top" title="Skip to POD">pod</a></dt> |
355 |
<dl> |
<dd>$pod_toc</dd> |
356 |
$runnable |
| if $pod_toc; |
357 |
$has_tests |
|
358 |
</dl> |
my $has_source = qq| |
359 |
| |
<dt><a href="#source" title="Skip to source">source</a></dt> |
360 |
. join(' ', |
| if $source; |
361 |
$pod ? qq|<a class="frey-skip" style="float: left;" href="#___top" title="Skip to POD" >pod</a>| : '', |
|
362 |
$source ? qq|<a class="frey-skip" style="float: right;" href="#source" title="Skip to source" >source</a>| : '' |
my $right = qq| |
363 |
) |
<dl> |
364 |
; |
$runnable |
365 |
|
$has_tests |
366 |
|
$has_pod |
367 |
|
$has_source |
368 |
|
</dl> |
369 |
|
|; |
370 |
|
|
371 |
|
|
372 |
return |
return |
373 |
qq| |
qq| |
376 |
$superclasses $roles |
$superclasses $roles |
377 |
<br>$includes |
<br>$includes |
378 |
</div> |
</div> |
379 |
<div class="right"> |
<div class="frey-introspect-right"> |
380 |
$right |
$right |
381 |
</div> |
</div> |
382 |
$table |
$table |