--- trunk/lib/Frey/Run.pm 2008/08/31 18:02:50 180 +++ trunk/lib/Frey/Run.pm 2008/10/31 23:17:56 222 @@ -2,11 +2,17 @@ use Moose; extends 'Frey'; with 'Frey::Web'; +with 'Frey::Config'; =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 or C method on the. + =cut has 'class' => ( @@ -17,7 +23,7 @@ use Data::Dump qw/dump/; -sub html { +sub request { my ( $self, $req ) = @_; my %params = $req->params; @@ -39,15 +45,28 @@ 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'); - $html = $o->markup; + 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"; + } else { + $html = "IGNORE: $class ", $o->dump; + warn $html; + } } - warn ">>> markup $class ",length( $html ), " bytes\n"; $req->print( $self->page( title => $class, body => $html ) ); }