--- trunk/lib/Frey/Web.pm 2008/11/18 00:30:29 389 +++ trunk/lib/Frey/Web.pm 2008/11/18 02:14:40 398 @@ -1,6 +1,8 @@ package Frey::Web; use Moose::Role; +#with 'Frey::Escape'; + use Frey::Types; use Continuity::Widget::DomNode; @@ -24,7 +26,7 @@ ] }, ); -has 'urequest_url' => ( +has 'request_url' => ( is => 'rw', isa => 'Uri', coerce => 1, default => '/', @@ -124,9 +126,18 @@ my $status_line = ''; foreach my $part ( @{ $self->status } ) { + confess "part not hash ",dump( $part ) unless ref($part) eq 'HASH'; foreach my $name ( keys %$part ) { - warn "### part [$name] = ", length( $part->{name} ), " bytes" if $self->debug; - $status_line .= qq|$name| . $part->{$name} . qq||; + my $content = $part->{$name}; + if ( ref($content) ) { + $content = '' . dump($content) . ''; + my $l = length($content); + $content = qq|$l bytes| if $l > 1024; + } else { + $content = qq|$content|; + } + warn "### part [$name] = ", length( $content ), " bytes" if $self->debug; + $status_line .= qq|$name $content\n|; } } @@ -141,7 +152,7 @@ qq|
Frey $Frey::VERSION - | . $self->urequest_url . qq| + | . $self->request_url . qq| $status_line
@@ -154,9 +165,10 @@ } sub error { - my ( $self, $error ) = @_; + my $self = shift; + my $error = join(" ", @_); my ($package, $filename, $line) = caller; - $error .= " at $filename line $line"; + $error .= " at $filename line $line" if $error !~ m{ at }; warn "WARN: $error\n"; $error =~ s{at\s+(\S+)\s+line\s+(\d+)}{at $1 line $2}gsm; return qq|
$error
|;