--- trunk/lib/Frey/Run.pm 2008/11/28 16:44:16 592 +++ trunk/lib/Frey/Run.pm 2008/12/10 14:22:59 790 @@ -57,6 +57,17 @@ default => 'html', ); +has 'request_url' => ( + documentation => 'Take url from params if not specified', + is => 'rw', + isa => 'Uri', coerce => 1, + lazy => 1, + default => sub { + my $self = shift; + $self->params->{request_url}; + }, +); + sub html { my ( $self ) = @_; @@ -106,10 +117,9 @@ $body .= ''; } } elsif ( $self->run =~ m{as_data} ) { - $data = $o->{$self->run}(); - warn "no data from ", $self->run; - $data ||= $o->as_data(); - confess "no data for $class->" . $self->run . " from " . $self->html_dump( $data ) unless $data; + my $run = $self->run; + $data = $o->$run; + confess "no data for $class->$run" unless defined $data; $self->add_status( { $self->run => $data } ); } else { $body = $self->error( "IGNORE: $class ", $o->dump ); @@ -124,10 +134,11 @@ $body .= Frey::View::Dumper->new( data => $data )->as_markup if defined $data; } - $self->title( $class ); + $o->title( $class ); $html = $o->page( body => $body ) if $body && !$html; - + $self->content_type( $o->content_type ); + confess "no html output for $class ", $o->dump unless defined $html; }; @@ -136,12 +147,14 @@ $self->status_parts; if ( $@ ) { + my $error = $@; my $o = Frey->new; + $o->{request_url} = $self->request_url; # sigh, this is dynamic languge, right? Frey::Web->meta->apply( $o ); - $html = $o->page( body => $self->error( $@ ) ); + $html = $o->page( body => $self->error( $error ) ); } - warn $self->class, " produced ", length($html), " bytes"; + warn $self->class, " produced ", length($html), " bytes of ", $self->content_type; return $html; }