--- trunk/lib/Frey/Introspect.pm 2008/07/13 19:46:10 120
+++ trunk/lib/Frey/Introspect.pm 2008/07/15 14:56:28 134
@@ -138,18 +138,6 @@
while (1) {
- my $js = $self->head_javascript;
- $js .= << '__END_OF_JS__';
-
-__END_OF_JS__
-
my ( $class, $meta, $is_role ) = $self->load_package;
my $package = $self->package;
@@ -161,10 +149,9 @@
if ( $class->get_attribute_list ) {
@attributes = map {
my $attr = $class->get_attribute($_);
-# warn "## $_ ", $attr->is_required ? 'required' : 'optional';
- qq|
$_ | | .
- ( $attr->is_required ? ' required' : '' ) .
- qq| | |;
+ my ( $before, $title, $after ) = ( '', '', '' );
+ ( $before, $title, $after ) = ( '', ' title="required"', '' ) if $attr->can('is_required') && $attr->is_required;
+ qq|$before$_$after | |
} sort $class->get_attribute_list
}
@@ -179,22 +166,39 @@
my $classes =
qq|| .
- Frey::ClassBrowser->new->html_markup .
+ Frey::ClassBrowser->new->markup .
qq|
|;
- my $html = dom2html(
- html => [
- head => [
- link => { rel=>"stylesheet", href=>"/static/app.css", type=>"text/css", media=>"screen" },
- $js,
- title => [ 'Introspect ', $self->package ],
- ],
- body => [
- h1 => [ $self->package ],
- $table,
- $classes,
- ],
- ]
+ $self->add_css( 'static/introspect.css' );
+
+ warn "## css = ",dump( $self->css );
+
+ my ( $superclasses, $roles ) = ( '', 'Role' );
+ if ( ! $is_role ) {
+ if ( $meta->superclasses ) {
+ $superclasses = 'Superclasses: ' .
+ join(', ',
+ map { my $s = $_->meta->name; qq|$s| }
+ #grep { $_ ne 'Moose::Object' }
+ $meta->superclasses
+ );
+ }
+
+ if ( $meta->can('roles') ) {
+ $roles = join(', ', map { my $r = $_->name; qq|$r| } @{ $meta->roles } );
+ $roles = " with roles: $roles" if $roles;
+ }
+ }
+
+ my $pod = Frey::Pod->new( class => $package )->markup;
+
+ my $html = $self->page(
+ title => "Introspect $package",
+ body => qq|$package
|
+ . qq|$superclasses\n$roles\n|
+ . ( $pod ? qq|↓pod&darr| : '' )
+ . qq|$table\n$pod\n$classes|,
+
);
$request->print($html);