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

Diff of /trunk/lib/Frey/Introspect.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 119 by dpavlin, Sun Jul 13 18:01:40 2008 UTC revision 120 by dpavlin, Sun Jul 13 19:46:10 2008 UTC
# Line 114  sub methods { Line 114  sub methods {
114          my @methods = grep { ! defined($attr->{$_}) } $class->get_method_list;          my @methods = grep { ! defined($attr->{$_}) } $class->get_method_list;
115          warn "# methods = ",dump( @methods ) if $self->debug;          warn "# methods = ",dump( @methods ) if $self->debug;
116    
117          return @methods;          return sort @methods;
118  }  }
119    
120  use Frey::ClassLoader;  use Frey::ClassLoader;
# Line 152  __END_OF_JS__ Line 152  __END_OF_JS__
152    
153                  my ( $class, $meta, $is_role ) = $self->load_package;                  my ( $class, $meta, $is_role ) = $self->load_package;
154    
155                  my $methods;                  my $package = $self->package;
156                  if ( $class->can('meta') ) {  
157                          $methods = dom2html(                  my @methods;
158                                  ul => [                  @methods = map { qq|<td><a href="/~/$package/$_">$_</a></td>| } $self->methods if $class->can('meta');
                                         map { (  
                                                 li => [ a => { href => '/~/' . $self->package . '/' . $_ } => [ $_ ] ]  
                                         ) } $self->methods  
                                 ]  
                         );  
                         $methods = "<h2>Methods</h2>$methods" if $methods;  
                 } else {  
                         $methods = '<b>not introspectable</b>';  
                 }  
159    
160                  my $attributes;                  my @attributes;
161                  if ( $class->get_attribute_list ) {                  if ( $class->get_attribute_list ) {
162                          $attributes = dom2html(                  @attributes = map {
163                                  table => [                                  my $attr = $class->get_attribute($_);
164                                          map {  #                               warn "## $_ ", $attr->is_required ? 'required' : 'optional';
165                                                  my $attr = $class->get_attribute($_);                                  qq|<td><a href="/~/$package/$_?">$_</a></td><td>| .
166                                                  warn "## $_ ", $attr->is_required ? 'required' : 'optional';                                  ( $attr->is_required ? ' <b>required</b>' : '' ) .
167                                                  ( tr => [                                  qq|</td>|;
168                                                          td => [ a => { href => '/~/' . $self->package . '/' . $_ } => [ $_ ] ],                          } sort $class->get_attribute_list
169                                                          td => [ $attr->is_required ? ' <b>required</b>' : '' ],                  }
170                                                  ] )  
171                                          } $class->get_attribute_list                  my $table = qq|<table><tr><th>Methods</th><th>Attributes</th></tr>|;
172                                  ],                  while ( @methods || @attributes ) {
173                          );                          my ($m,$a) = ( shift @methods, shift @attributes );
174                          $attributes = "<h2>Attributes</h2>$attributes" if $attributes;                          $m ||= '<td></td>';
175                  } else {                          $a ||= '<td></td>';
176                          $attributes = '<b>no attributes</b>';                          $table .= qq|<tr>$m$a</tr>|;
177                  }                  }
178                    $table .= qq|</table>|;
179    
180                    my $classes =
181                            qq|<div class="classes">| .
182                            Frey::ClassBrowser->new->html_markup .
183                            qq|</div>|;
184    
185                  my $html = dom2html(                  my $html = dom2html(
186                          html => [                          html => [
# Line 195  __END_OF_JS__ Line 191  __END_OF_JS__
191                                  ],                                  ],
192                                  body => [                                  body => [
193                                          h1 => [ $self->package ],                                          h1 => [ $self->package ],
194                                          $methods,                                          $table,
195                                          $attributes,                                          $classes,
196                                  ],                                  ],
197                          ]                          ]
198                  );                  );

Legend:
Removed from v.119  
changed lines
  Added in v.120

  ViewVC Help
Powered by ViewVC 1.1.26