--- trunk/lib/Frey/Run.pm 2008/11/16 14:17:18 354 +++ trunk/lib/Frey/Run.pm 2008/11/16 19:57:00 365 @@ -71,12 +71,11 @@ $html = qq|

$class params

|; my $a; - my @attrs = map { $a->{$_}++; $_ } $self->attribute_order; + my @attrs = map { $a->{$_}++; $_ } @{ $self->attribute_order }; push @attrs, $_ foreach grep { ! $a->{$_} } map { $_->name } @required; warn "# attrs = ",dump( @attrs ); - foreach my $name ( @attrs ) { - my $attr = $class->meta->get_attribute( $name ); + foreach my $name ( grep { ! $class->meta->get_attribute($_)->is_lazy } @attrs ) { my $type = $name =~ m/^pass/ ? 'password' : 'text'; my $value = ''; my $value_html = ''; @@ -89,12 +88,16 @@ qq|| } @$values ) . qq||; - } elsif ( $attr->has_type_constraint && $attr->type_constraint->can('values') ) { - $value_html = qq||; - } elsif ( $attr->has_default ) { - $value = $attr->default( $name ); + } elsif ( my $attr = $class->meta->get_attribute( $name ) ) { + if ( $attr->has_type_constraint && $attr->type_constraint->can('values') ) { + $value_html = qq||; + } elsif ( $attr->has_default ) { + $value = $attr->default( $name ); + } + } else { + warn "wired attribute $name"; } $value_html = qq|| unless $value_html; @@ -115,7 +118,9 @@ } elsif ( $self->run eq 'sponge' ) { my $data = $o->sponge; confess "invalid data from sponge = ", dump( $data ) unless ref($data) eq 'HASH'; - $html .= "" . $#{ $data->{rows} } . " rows from $class->new" . dump( $self->params ) . "->sponge"; + my $rows = $#{ $data->{rows} } + 1; + $rows ||= 'no'; + $html .= "$rows rows from $class->new" . dump( $self->params ) . "->sponge"; $html .= ''; $html .= ''; $html .= '' foreach @{ $data->{rows} }; @@ -123,7 +128,7 @@ } elsif ( $self->run eq 'data' ) { my $data = $o->data; $html .= Frey::Dumper->new( data => $data )->markup; - $html .= '
' . $self->html_dump( $data ) . ''; + $html .= '
dump' . $self->html_dump( $data ) . ''; } else { $html = $self->error( "IGNORE: $class ", $o->dump ); } @@ -132,6 +137,7 @@ $html .= $self->error( $@ ) if $@; } + return $self->page( %$html ) if ref($html) eq 'HASH'; return $self->page( title => $class, body => $html ); }
' . join('', @{$data->{NAME}} ) . '
' . join('', @$_ ) . '