--- trunk/lib/Frey/Run.pm 2008/10/28 18:33:53 195 +++ trunk/lib/Frey/Run.pm 2008/11/01 00:59:02 225 @@ -2,13 +2,22 @@ use Moose; extends 'Frey'; with 'Frey::Web'; +with 'Frey::Config'; +with 'Frey::Escape'; =head1 NAME Frey::Run - display required form field for Class and run it +=head1 DESCRIPTION + +This object will try to run other Moose objects from your application. It +will try to invoke C, C or C method on the. + =cut +sub execute { qw/data markup request/ } + has 'class' => ( is => 'rw', isa => 'Str', @@ -17,7 +26,7 @@ use Data::Dump qw/dump/; -sub html { +sub request { my ( $self, $req ) = @_; my %params = $req->params; @@ -39,18 +48,27 @@ if ( @required ) { $html = qq|

Required params for $class

|; - $html .= qq|| foreach @required; + foreach my $name ( @required ) { + my $type = $name =~ m/^pass/ ? 'password' : 'text'; + my $value = $self->config($class)->{$name}; + $html .= qq||; + } $html .= qq|
|; } else { my $o = $class->new( %params ); $o->depends if $o->can('depends'); - if ( $o->can('html') ) { - warn "## turning over to $o->html"; - $o->html( $req ); - } else { + if ( $o->can('request') ) { + warn "## turning over to $o->request"; + $o->request( $req ); + } elsif ( $o->can('markup') ) { warn "## using $o->markup"; $html = $o->markup; warn ">>> markup $class ",length( $html ), " bytes\n"; + } elsif ( $o->can('data') ) { + $html = '' . $self->html_escape( dump( $o->data ) ) . ''; + } else { + $html = "IGNORE: $class ", $o->dump; + warn $html; } }