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

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

revision 506 by dpavlin, Mon Nov 24 21:32:32 2008 UTC revision 507 by dpavlin, Tue Nov 25 00:26:15 2008 UTC
# Line 83  sub html { Line 83  sub html {
83    
84                          $o->depends if $o->can('depends');                          $o->depends if $o->can('depends');
85    
86                          push @{ $self->status }, { $self->editor( $class ) => $self->params };                          my @status;
87    
88                          if ( $self->run eq 'as_markup' ) {                          push @status, { $self->editor( $class ) => $self->params } if $o->can('status');
89    
90                            if ( $self->run eq 'as_markup' && ! $o->can('page') ) {
91                                  warn "## using ",ref($o), "->as_markup";                                  warn "## using ",ref($o), "->as_markup";
                                 if ( $o->can('page') ) {  
                                         $html = $o->page;  
                                 }  
92                                  $body = $o->as_markup unless $html;                                  $body = $o->as_markup unless $html;
93                                  warn ">>> markup $class ",length( $html || $body ), " ", $html ? 'html' : 'body', " bytes";                                  warn ">>> markup $class ",length( $body ), " ", $html ? 'html' : 'body', " bytes";
94                          } elsif ( $self->run eq 'as_sponge' ) {                          } elsif ( $self->run eq 'as_sponge' ) {
95                                  $data = $o->as_sponge;                                  $data = $o->as_sponge;
96                                  confess "invalid data from sponge = ", dump( $data ) unless ref($data) eq 'HASH';                                  confess "invalid data from sponge = ", dump( $data ) unless ref($data) eq 'HASH';
# Line 113  sub html { Line 112  sub html {
112                          if ( defined $data ) {                          if ( defined $data ) {
113                                  $html .= to_json( $data ) if $self->format =~ m{js(on)?};                                  $html .= to_json( $data ) if $self->format =~ m{js(on)?};
114                                  $html .= Dump( $data )    if $self->format =~ m{ya?ml};                                  $html .= Dump( $data )    if $self->format =~ m{ya?ml};
115                                  push @{ $self->status }, { 'data' => $data };                                  push @status, { 'data' => $data };
116                          }                          }
117                          if ( ! $html ) {                          if ( ! $html ) {
118                                  $body  = Frey::View::Dumper->new( data => $body )->as_markup if ref $body;                                  $body  = Frey::View::Dumper->new( data => $body )->as_markup if ref $body;
119                                  $body .= Frey::View::Dumper->new( data => $data )->as_markup if defined $data;                                  $body .= Frey::View::Dumper->new( data => $data )->as_markup if defined $data;
120                          }                          }
121    
122                          # override our status with one from object                          if ( $self->run eq 'as_markup' && $o->can('page') ) {
123                          eval {                                  $o->add_status($_) foreach @status;
124                                  $self->status( $o->status );                                  $html = $o->page if $o->can('page') &&
125                          };                                  warn "got ", length($html), "for page";
126                          warn "can't override status: $@" if $@;                          }
                 };  
127    
128                            $self->add_status($_) foreach @status;
129                    };
130    
131                  if ( ref($body) eq 'HASH' ) {                  if ( ref($body) eq 'HASH' ) {
132                          $html = $self->page( %$body );                          $html = $self->page( %$body );
133                            warn "WARNING: old calling method which is depriciated";
134                  } elsif ( $body && ! $html ) {                  } elsif ( $body && ! $html ) {
135                          $html = $self->page( title => $self->class . ' run', body => $body );                          $html = $self->page( title => $self->class . ' run', body => $body );
136                  };                  };

Legend:
Removed from v.506  
changed lines
  Added in v.507

  ViewVC Help
Powered by ViewVC 1.1.26