/[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 893 by dpavlin, Wed Dec 24 21:42:00 2008 UTC revision 961 by dpavlin, Wed Jan 7 19:41:48 2009 UTC
# Line 75  sub html { Line 75  sub html {
75          my ( $self ) = @_;          my ( $self ) = @_;
76    
77          my ($html,$body,$data);          my ($html,$body,$data);
78    
79            my $current_status;
80            $current_status->{$_}++ foreach $self->status;
81    
82          eval {          eval {
83                  my $class = $self->class;                  my $class = $self->class;
84                  $self->load_class( $class );                  $self->load_class( $class );
85    
86                  if ( my $form = $self->params_form ) {                  if ( my $form = $self->params_form ) {
87                          $html = $self->page( body => $form );                          $html = $self->html_page( body => $form );
88                          warn "got required params form for $class ", $self->run, " format: ", $self->format;                          warn "got required params form for $class ", $self->run, " format: ", $self->format;
89                  } else {                  } else {
90    
# Line 106  sub html { Line 110  sub html {
110                          $o->depends if $o->can('depends');                          $o->depends if $o->can('depends');
111    
112                          if ( $self->run =~ m{as_markup} ) {                          if ( $self->run =~ m{as_markup} ) {
113                                  $html = $o->page( run => $self->run );                                  $html = $o->html_page( run => $self->run );
114                          } elsif ( $self->run =~ m{(.*as_sponge)} ) {                          } elsif ( $self->run =~ m{(.*as_sponge)} ) {
115                                  $data = $o->$1;                                  $data = $o->$1;
116                                  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 118  sub html { Line 122  sub html {
122                                          $body .= '<tr><th>' . join('</th><th>', @{$data->{NAME}} ) . '</th></tr>';                                          $body .= '<tr><th>' . join('</th><th>', @{$data->{NAME}} ) . '</th></tr>';
123                                          $body .= '<tr><td>' . join('</td><td>', @$_ ) . '</td></tr>' foreach @{ $data->{rows} };                                          $body .= '<tr><td>' . join('</td><td>', @$_ ) . '</td></tr>' foreach @{ $data->{rows} };
124                                          $body .= '</table>';                                          $body .= '</table>';
125                                            
126                                            delete( $data->{rows} ); # too much dumplication
127                                            $body .= Frey::View::Dumper->new( data => $data )->as_markup if $data;
128                                  }                                  }
129                          } elsif ( $self->run =~ m{(as_data|sql)} ) {                          } elsif ( $self->run =~ m{(as_data|sql)} ) {
130                                  my $run = $self->run;                                  my $run = $self->run;
# Line 139  sub html { Line 146  sub html {
146    
147                          $o->title( $class );                          $o->title( $class );
148    
149                          $html = $o->page( body => $body ) if $body && !$html;                          $html = $o->html_page( body => $body ) if $body && !$html;
150                          $self->content_type( $o->content_type );                          $self->content_type( $o->content_type );
151    
152                          confess "no html output for $class ", $o->dump unless defined $html;                          confess "no html output for $class ", $o->dump unless defined $html;
153    
154                            if ( $o->can('status') ) {
155                                    foreach ( $o->status ) {
156                                            next if $current_status->{$_}++;
157                                            $self->add_status( $_ );
158                                            warn "# run add_status: ", $self->dump( $_ );
159                                    }
160                            }
161    
162                  };                  };
163    
164          };          };
# Line 154  sub html { Line 170  sub html {
170                  my $o = Frey->new;                  my $o = Frey->new;
171                  $o->{request_url} = $self->request_url; # sigh, this is dynamic languge, right?                  $o->{request_url} = $self->request_url; # sigh, this is dynamic languge, right?
172                  Frey::Web->meta->apply( $o );                  Frey::Web->meta->apply( $o );
173                  $html = $o->page( body => $self->error( $error, undef ) );                  $html = $o->html_page( body => $self->error( $error, undef ) );
174          }          }
175    
176          warn $self->class, " produced ", length($html), " bytes of ", $self->content_type;          warn $self->class, " produced ", length($html), " bytes of ", $self->content_type;

Legend:
Removed from v.893  
changed lines
  Added in v.961

  ViewVC Help
Powered by ViewVC 1.1.26