/[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 457 by dpavlin, Wed Nov 19 16:53:13 2008 UTC revision 517 by dpavlin, Tue Nov 25 14:15:34 2008 UTC
# Line 7  with 'Frey::Escape'; Line 7  with 'Frey::Escape';
7  with 'Frey::Session';  with 'Frey::Session';
8    
9  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
10  use Frey::Dumper;  use Frey::View::Dumper;
11  use JSON;  use JSON;
12  use YAML;  use YAML;
13    
# 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 }, { qq|<a target="editor" href="/editor+$class+1">$class</a>| => $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( $body ), " ", $html ? 'html' : 'body', " bytes";
                                 warn ">>> markup $class ",length( $html || $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 114  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::Dumper->new( data => $data )->as_markup;                                  $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;
120                          }                          }
121    
122                          # override our status with one from object                          warn "# status ",dump(@status);
                         eval {  
                                 $self->status( $o->status );  
                         };  
                         warn "can't override status: $@" if $@;  
                 };  
123    
124                            if ( $self->run eq 'as_markup' && $o->can('page') ) {
125                                    $o->add_status($_) foreach @status;
126                                    $html = $o->page;
127                                    warn "got ", length($html), "for page";
128                            } else {
129                                    $self->add_status($_) foreach @status;
130                            }
131                    };
132    
133                  if ( ref($body) eq 'HASH' ) {                  if ( ref($body) eq 'HASH' ) {
134                          $html = $self->page( %$body );                          $html = $self->page( %$body );
135                            warn "WARNING: old calling method which is depriciated";
136                  } elsif ( $body && ! $html ) {                  } elsif ( $body && ! $html ) {
137                          $html = $self->page( title => $self->class . ' run', body => $body );                          $html = $self->page( title => $self->class . ' run', body => $body );
138                  };                  };

Legend:
Removed from v.457  
changed lines
  Added in v.517

  ViewVC Help
Powered by ViewVC 1.1.26