--- trunk/lib/Frey/Run.pm 2008/11/08 23:34:43 339 +++ trunk/lib/Frey/Run.pm 2008/11/16 00:25:39 349 @@ -20,6 +20,10 @@ =cut +use Moose::Util::TypeConstraints; + +enum 'Runnable' => qw/data markup sponge/; + sub runnable { qw/data markup sponge/ } has 'class' => ( @@ -34,6 +38,11 @@ default => sub { {} }, ); +has 'run' => ( + is => 'rw', + isa => 'Runnable', +); + sub html { my ( $self ) = @_; @@ -68,12 +77,28 @@ foreach my $name ( @attrs ) { my $attr = $class->meta->get_attribute( $name ); my $type = $name =~ m/^pass/ ? 'password' : 'text'; - my $value = - $values ? $values->{$name} : - $attr->has_default ? $attr->default( $name ) : - ''; + my $value = ''; + my $value_html = ''; + if ( ref($values) eq 'HASH' ) { + $value = $values->{$name}; + } elsif ( ref($values) eq 'ARRAY' ) { + $value_html = qq||; + } elsif ( $attr->has_type_constraint && $attr->type_constraint->can('values') ) { + $value_html = qq||; + } elsif ( $attr->has_default ) { + $value = $attr->default( $name ); + } + $value_html = qq|| unless $value_html; + #warn "# required $name ", $class->meta->get_attribute( $name )->dump( 2 ); - $html .= qq||; + $html .= qq|| . $value_html; } $html .= qq||; } else {