4 |
extends 'Frey::Action'; |
extends 'Frey::Action'; |
5 |
with 'Frey::Web'; |
with 'Frey::Web'; |
6 |
with 'Frey::Escape'; |
with 'Frey::Escape'; |
7 |
|
with 'Frey::Session'; |
8 |
|
|
9 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
10 |
use Frey::Dumper; |
use Frey::Dumper; |
11 |
use JSON; |
use JSON; |
12 |
|
use YAML; |
13 |
|
|
14 |
=head1 NAME |
=head1 NAME |
15 |
|
|
70 |
warn "got required params form for $class ", $self->run, " format: ", $self->format; |
warn "got required params form for $class ", $self->run, " format: ", $self->format; |
71 |
} else { |
} else { |
72 |
|
|
73 |
my $o = $class->new( %{ $self->params } ); |
$self->usage->{ $class }++; |
74 |
|
|
75 |
|
my $o; |
76 |
|
my ( $meta, $is_role, $instance ) = $self->class_meta( $class ); |
77 |
|
if ( $is_role ) { |
78 |
|
$o = $instance; |
79 |
|
} else { |
80 |
|
$o = $class->new( %{ $self->params } ); |
81 |
|
} |
82 |
|
|
83 |
$o->depends if $o->can('depends'); |
$o->depends if $o->can('depends'); |
84 |
|
|
85 |
push @{ $self->status }, { qq|<a target="editor" href="/editor+$class+1">$class</a>| => $self->params }; |
push @{ $self->status }, { qq|<a target="editor" href="/editor+$class+1">$class</a>| => $self->params }; |
88 |
warn "## using ",ref($o), "->markup"; |
warn "## using ",ref($o), "->markup"; |
89 |
if ( $o->can('page') ) { |
if ( $o->can('page') ) { |
90 |
$html = $o->page; |
$html = $o->page; |
|
$body = $o->markup unless $html; |
|
|
} else { |
|
|
$body = $o->markup; |
|
91 |
} |
} |
92 |
|
$body = $o->markup unless $html; |
93 |
|
|
94 |
warn ">>> markup $class ",length( $html || $body ), " ", $html ? 'html' : 'body', " bytes"; |
warn ">>> markup $class ",length( $html || $body ), " ", $html ? 'html' : 'body', " bytes"; |
95 |
} elsif ( $self->run eq 'sponge' ) { |
} elsif ( $self->run eq 'sponge' ) { |
120 |
} |
} |
121 |
|
|
122 |
# override our status with one from object |
# override our status with one from object |
123 |
$self->status( $o->status ) if $o->can('status') && $o->status; |
eval { |
124 |
|
$self->status( $o->status ); |
125 |
|
}; |
126 |
|
warn "can't override status: $@" if $@; |
127 |
}; |
}; |
128 |
|
|
129 |
|
|
134 |
}; |
}; |
135 |
}; |
}; |
136 |
|
|
137 |
$html = $self->page( title => $self->class, body => dump($html) . $self->error( $@ ) ) if $@; |
$html = $self->page( title => $self->class, body => $self->error( $@ ) ) if $@; |
138 |
|
|
139 |
return $html; |
return $html; |
140 |
} |
} |