/[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 348 by dpavlin, Sat Nov 15 23:52:22 2008 UTC revision 350 by dpavlin, Sun Nov 16 00:37:34 2008 UTC
# Line 20  will try to invoke C<data>, and C<markup Line 20  will try to invoke C<data>, and C<markup
20    
21  =cut  =cut
22    
23    use Moose::Util::TypeConstraints;
24    
25    enum 'Runnable' => qw/data markup sponge/;
26    
27  sub runnable { qw/data markup sponge/ }  sub runnable { qw/data markup sponge/ }
28    
29  has 'class' => (  has 'class' => (
# Line 34  has 'params' => ( Line 38  has 'params' => (
38          default => sub { {} },          default => sub { {} },
39  );  );
40    
41    has 'run' => (
42            is => 'rw',
43            isa => 'Runnable',
44    );
45    
46  sub html {  sub html {
47          my ( $self ) = @_;          my ( $self ) = @_;
48    
# Line 79  sub html { Line 88  sub html {
88                                                  qq|<option value="$v">$v</option>|                                                  qq|<option value="$v">$v</option>|
89                                          } @$values                                          } @$values
90                                  ) . qq|</select>|;                                  ) . qq|</select>|;
91                          } else {                          } elsif ( $attr->has_type_constraint && $attr->type_constraint->can('values') ) {
92                                  $value = $attr->default( $name ) if $attr->has_default;                                  $value_html = qq|<select name="$name">| . join("\n",
93                                            map { qq|<option value="$_">$_</option>| } @{ $attr->type_constraint->values }
94                                    ) . qq|</select>|;
95                            } elsif ( $attr->has_default ) {
96                                    $value = $attr->default( $name );
97                          }                          }
98                          $value_html = qq|<input type="$type" name="$name" value="$value">| unless $value_html;                          $value_html = qq|<input type="$type" name="$name" value="$value">| unless $value_html;
99    
# Line 94  sub html { Line 107  sub html {
107                  if ( $o->can('markup') ) {                  if ( $o->can('markup') ) {
108                          warn "## using ",ref($o), "->markup";                          warn "## using ",ref($o), "->markup";
109                          $html = eval { $o->markup };                          $html = eval { $o->markup };
110                          if ( $@ ) {                          $html .= $self->error( $@ ) if $@;
                                 warn $@;  
                                 $html .= qq{<code>$@</code>};  
                         }  
111                          warn ">>> markup $class ",length( $html ), " bytes\n";                          warn ">>> markup $class ",length( $html ), " bytes\n";
112                  } elsif ( $o->can('sponge') ) {                  } elsif ( $o->can('sponge') ) {
113                          my $data = $o->sponge;                          my $data = $o->sponge;

Legend:
Removed from v.348  
changed lines
  Added in v.350

  ViewVC Help
Powered by ViewVC 1.1.26