/[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 943 by dpavlin, Tue Jan 6 14:50:30 2009 UTC revision 1022 by dpavlin, Mon Jan 26 23:30:09 2009 UTC
# Line 60  sub joose { Line 60  sub joose {
60                  $out .= "\t\t\t$_: {\n";                  $out .= "\t\t\t$_: {\n";
61    
62                  my $attr = $meta->get_attribute($_);                  my $attr = $meta->get_attribute($_);
63                  my $is = $attr->_is_metadata;                  my $is = eval { $attr->_is_metadata; };
64                    return if $@;
65    
66                  $out .= "\t\t\t\tis: \"$is\",\n" if defined $is;                  $out .= "\t\t\t\tis: \"$is\",\n" if defined $is;
67                  $out .= "\t\t\t\tlazy: true,\n" if $attr->is_lazy;                  $out .= "\t\t\t\tlazy: true,\n" if $attr->is_lazy;
68                  $out .= "\t\t\t\trequired: true,\n" if $attr->is_required;                  $out .= "\t\t\t\trequired: true,\n" if $attr->is_required;
# Line 275  sub as_markup { Line 277  sub as_markup {
277  #       $source =~ s{^.*<body[^>]+>}{}s;  #       $source =~ s{^.*<body[^>]+>}{}s;
278  #       $source =~ s{</body.*$}{}s;  #       $source =~ s{</body.*$}{}s;
279    
280          my $runnable = join("\n",          my $runnable = join("</dd><dd>",
281                  map {                  map {
282                          $introspect->{runnable}->{$_} = {};                          $introspect->{runnable}->{$_} = {};
283                          my $short = $_;                          my $short = $_;
# Line 283  sub as_markup { Line 285  sub as_markup {
285                          qq|<a target="$class" href="/$class/$_" title="/$class/$_">$short</a>|                          qq|<a target="$class" href="/$class/$_" title="/$class/$_">$short</a>|
286                  } $self->class_runnable( $class )                  } $self->class_runnable( $class )
287          );          );
288          $runnable = "Runnable: $runnable" if $runnable;          $runnable = "<dt>runnable</dt><dd>$runnable</dd>" if $runnable;
289    
290          my $has_tests = '';          my $has_tests = '';
291          my @tests = grep { defined $_ } $self->has_tests;          my @tests = grep { defined $_ } $self->has_tests;
292          if ( @tests ) {          if ( @tests ) {
293                  $has_tests =                  $has_tests
294                  'Test' . ( $#tests > 0 ? 's' : '' ) . ': ' .                              = qq|<dt>test|
295                  join("\n", map {                          . ( $#tests > 0 ? 's' : '' )
296                          qq|<a target="$class" href="/Frey::Test::Runner/as_markup?test=$_">$_</a>|                          . qq|<dt><dd>|
297                  } @tests );                          . join("</dd><dd>", map {
298                                    qq|<a target="$class" href="/Frey::Test::Runner/as_markup?test=$_">$_</a>|
299                            } @tests )
300                            . qq|</dd>|
301                            ;
302                  $introspect->{tests} = [ @tests ],                  $introspect->{tests} = [ @tests ],
303          }          }
304    
# Line 316  sub as_markup { Line 322  sub as_markup {
322    
323          $self->store( $introspect_path, $introspect );          $self->store( $introspect_path, $introspect );
324    
325          return join("\n",          $self->add_css(qq|
326                  qq|<h1>$class</h1>|,                  .right {
327                  qq|<div class="frey-introspect">                          position: fixed;
328                          $superclasses $roles                          top: 1em;
329                          <br>                          right: 1em;
330                          $includes                          z-index: 10;
331                          <br>                          background: #ffc;
332                            padding: 0.5em;
333                            width: 20%;
334                            font-size: 80%;
335                    }
336                    .right dl dd {
337                            margin-left: 1em;
338                    }
339            |);
340    
341            my $right
342                    = qq|
343                            <dl>
344                          $runnable                          $runnable
345                  |,                          $has_tests
346                  $has_tests,                          </dl>
347                  $pod    ? qq|<a class="frey-skip" href="#___top" title="Skip to POD"    >pod</a>|    : '',                  |
348                  $source ? qq|<a class="frey-skip" href="#source" title="Skip to source" >source</a>| : '',                  . join('&nbsp;',
349                  qq|$table\n$pod\n</div>\n|,                          $pod    ? qq|<a class="frey-skip" style="float: left;" href="#___top" title="Skip to POD"    >pod</a>|    : '',
350                  qq|<h1>Source</h1><a name="source"></a><div class="frey-source">$source</div>|,                          $source ? qq|<a class="frey-skip" style="float: right;" href="#source" title="Skip to source" >source</a>| : ''
351          );                  )
352                    ;
353    
354            return
355                    qq|
356                            <h1>$class</h1>
357                            <div class="frey-introspect">
358                                    $superclasses $roles
359                                    <br>$includes
360                            </div>
361                            <div class="right">
362                                    $right
363                            </div>
364                            $table
365                            $pod
366                            </div>
367    
368                            <h1>Source</h1><a name="source"></a>
369                            <div class="frey-source">$source</div>
370                    |
371                    ;
372  }  }
373    
374  =head1 SEE ALSO  =head1 SEE ALSO

Legend:
Removed from v.943  
changed lines
  Added in v.1022

  ViewVC Help
Powered by ViewVC 1.1.26