/[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 140 by dpavlin, Wed Jul 16 00:06:19 2008 UTC revision 202 by dpavlin, Tue Oct 28 22:33:25 2008 UTC
# Line 138  sub load_package { Line 138  sub load_package {
138  sub html {  sub html {
139          my ( $self, $request ) = @_;          my ( $self, $request ) = @_;
140    
141          $self->add_css( 'static/introspect.css' );          $self->add_head( 'static/introspect.css' );
         warn "## css = ",dump( $self->css );  
142    
143          while (1) {          while (1) {
144    
# Line 156  sub html { Line 155  sub html {
155                                  my $attr = $meta->get_attribute($_);                                  my $attr = $meta->get_attribute($_);
156                                  my ( $before, $title, $after ) = ( '', '', '' );                                  my ( $before, $title, $after ) = ( '', '', '' );
157                                  ( $before, $title, $after ) = ( '<b>', ' title="required"', '</b>' ) if $attr->is_required;                                  ( $before, $title, $after ) = ( '<b>', ' title="required"', '</b>' ) if $attr->is_required;
158                                  qq|<td>$before<a href="/~/$package/?$_">$_</a>$after</td>|  warn $attr->dump(3);
159                                    foreach my $check ( qw/has_type_constraint has_handles is_weak_ref is_required is_lazy should_coerce should_auto_deref has_trigger has_documentation has_applied_traits/ ) {
160                                            my $getter;
161                                            
162                                            $getter = $check;
163                                            $getter =~ s/^has_//;
164                                            
165                                            if ( $attr->$check ) {
166                                                    if ( $getter eq $check ) {
167                                                            $after .= "$check";
168                                                    } else {
169                                                            $after .= qq{<span class="frey-popup">$check};
170                                                            $after .= '<span>' . $attr->$getter->dump . '</span>' if $getter ne $check;
171                                                            $after .= '</span>';
172                                                    }
173                                            }
174                                            $after .= ' ';
175                                    }
176                                    qq|<td align="right">$before<a href="/~/$package/?$_">$_</a></td><td>$after</td>|
177                          } sort $meta->get_attribute_list                          } sort $meta->get_attribute_list
178                  }                  }
179    
180                  my $table = qq|<table><tr><th>Methods</th><th>Attributes</th></tr>|;                  my $table = qq|<table class="frey-object-browser"><tr><th>Methods</th><th align="right">Attributes</th><th align="left">Properties</th></tr>|;
181                  while ( @methods || @attributes ) {                  while ( @methods || @attributes ) {
182                          my ($m,$a) = ( shift @methods, shift @attributes );                          my ($m,$a) = ( shift @methods, shift @attributes );
183                          $m ||= '<td></td>';                          $m ||= '<td></td>';
# Line 179  sub html { Line 196  sub html {
196                          if ( $meta->superclasses ) {                          if ( $meta->superclasses ) {
197                                  $superclasses = 'Superclasses: ' .                                  $superclasses = 'Superclasses: ' .
198                                          join(', ',                                          join(', ',
199                                                  map { my $s = $_->meta->name; qq|<a href="/~/$s">$s</a>| }                                                  map {
200                                                            my $name = $_->meta->name;
201                                                            qq|<a class="frey-popup" href="/~/$name">$name<span>| . $_->meta->dump(2) . qq|</span></a>|;
202                                                    }
203                                                  #grep { $_ ne 'Moose::Object' }                                                  #grep { $_ ne 'Moose::Object' }
204                                                  $meta->superclasses                                                  $meta->superclasses
205                                          );                                          );
# Line 189  sub html { Line 209  sub html {
209                  if ( $meta->can('roles') ) {                  if ( $meta->can('roles') ) {
210                          $roles = join(', ',                          $roles = join(', ',
211                                  grep { ! m/\Q$package\E/ }      # skip me                                  grep { ! m/\Q$package\E/ }      # skip me
212                                  map { my $r = $_->name; qq|<a href="/~/$r">$r</a>| }                                  map {
213                                            my $name = $_->name;
214                                            qq|<a class="frey-popup" href="/~/$name">$name<span>| . $name->meta->dump(2) . qq|</span></a>|;
215                                    }
216                                  $meta->calculate_all_roles                                  $meta->calculate_all_roles
217                          );                          );
218                          $roles = " with roles: $roles" if $roles;                          $roles = " with roles: $roles" if $roles;

Legend:
Removed from v.140  
changed lines
  Added in v.202

  ViewVC Help
Powered by ViewVC 1.1.26