/[Frey]/trunk/lib/Frey/Run.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Frey/Run.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 213 by dpavlin, Fri Oct 31 19:51:51 2008 UTC revision 223 by dpavlin, Sat Nov 1 00:14:05 2008 UTC
# Line 2  package Frey::Run; Line 2  package Frey::Run;
2  use Moose;  use Moose;
3  extends 'Frey';  extends 'Frey';
4  with 'Frey::Web';  with 'Frey::Web';
5    with 'Frey::Config';
6    
7  =head1 NAME  =head1 NAME
8    
# Line 10  Frey::Run - display required form field Line 11  Frey::Run - display required form field
11  =head1 DESCRIPTION  =head1 DESCRIPTION
12    
13  This object will try to run other Moose objects from your application. It  This object will try to run other Moose objects from your application. It
14  will try to invoke C<html> or C<markup> method on the.  will try to invoke C<data>, C<html> or C<markup> method on the.
15    
16  =cut  =cut
17    
18    sub execute { qw/data markup request/ }
19    
20  has 'class' => (  has 'class' => (
21          is => 'rw',          is => 'rw',
22          isa => 'Str',          isa => 'Str',
# Line 44  sub request { Line 47  sub request {
47    
48          if ( @required ) {          if ( @required ) {
49                  $html = qq|<h1>Required params for $class</h1><form method="post">|;                  $html = qq|<h1>Required params for $class</h1><form method="post">|;
50                  $html .= qq|<label for="$_">$_</label><input type="text" name="$_">| foreach @required;                  foreach my $name ( @required ) {
51                            my $type = $name =~ m/^pass/ ? 'password' : 'text';
52                            my $value = $self->config($class)->{$name};
53                            $html .= qq|<label for="$name">$name</label><input type="$type" name="$name" value="$value">|;
54                    }
55                  $html .= qq|<input type="submit" value="Run $class"></form>|;                  $html .= qq|<input type="submit" value="Run $class"></form>|;
56          } else {          } else {
57                  my $o = $class->new( %params );                  my $o = $class->new( %params );
# Line 56  sub request { Line 63  sub request {
63                          warn "## using $o->markup";                          warn "## using $o->markup";
64                          $html = $o->markup;                          $html = $o->markup;
65                          warn ">>> markup $class ",length( $html ), " bytes\n";                          warn ">>> markup $class ",length( $html ), " bytes\n";
66                    } elsif ( $o->can('data') ) {
67                            $html = '<code>' . dump( $o->data ) . '</code>';
68                  } else {                  } else {
69                          $html = "IGNORE: $class ", $o->dump;                          $html = "IGNORE: $class ", $o->dump;
70                          warn $html;                          warn $html;

Legend:
Removed from v.213  
changed lines
  Added in v.223

  ViewVC Help
Powered by ViewVC 1.1.26