35 |
my $out; |
my $out; |
36 |
my $pipe; |
my $pipe; |
37 |
|
|
38 |
|
$self->title( ref($self) . ' | ' . $self->pipe ); |
39 |
|
|
40 |
foreach my $part ( split(/\|/, $self->pipe ) ) { |
foreach my $part ( split(/\|/, $self->pipe ) ) { |
41 |
warn "# part: '$part'"; |
warn "# part: '$part'"; |
42 |
if ( $part =~ m{^([^/]+)/([^\+\?]+)(.*)?$} ) { |
if ( $part =~ m{^([^/]+)/([^\+\?]+)(.*)?$} ) { |
43 |
my ( $class, $method, $args ) = ( $1, $2, $3 ); |
my ( $class, $method, $args ) = ( $1, $2, $3 ); |
44 |
|
push @{ $self->status }, { $class => { method => $method, args => $args } }; |
45 |
my $params = $pipe; |
my $params = $pipe; |
46 |
$params = {} unless defined $params; |
$params = {} unless defined $params; |
47 |
if ( defined $args ) { |
if ( defined $args ) { |
55 |
} |
} |
56 |
|
|
57 |
my ( $html, $default ) = Frey::Action->new( class => $class, params => $params )->params_form; |
my ( $html, $default ) = Frey::Action->new( class => $class, params => $params )->params_form; |
58 |
warn "$class need more params than ",dump( $default ) if $html; # FIXME replace with query |
warn "$class need more params than ",dump( $default ) if $html && $self->debug; # FIXME replace with query |
59 |
|
|
60 |
|
warn "# pipe $part" if $self->debug; |
61 |
|
my $o = $class->new( %$default ); |
62 |
|
my $result = $o->$method; |
63 |
|
warn "# result ",length( $result ), " bytes ", ref($result); |
64 |
|
|
65 |
|
$self->content_type( $o->content_type ) if $o->can('content_type'); |
66 |
|
|
|
my $code = '$result = ' . $class . '->new' . dump( %$default ) . '->' . $method . '();'; |
|
|
warn "# pipe $part -> $code"; |
|
|
my $result; |
|
|
eval $code; |
|
|
die $@ if $@; |
|
|
warn "# result ",ref( $result ); |
|
|
# $out .= qq{<span class="frey-popdown">$part<code>} . dump( $result ) . '</code><span><hr>'; |
|
67 |
$out = $result; |
$out = $result; |
68 |
$pipe = { $method => $result }; |
$pipe = { $method => $result }; |
69 |
} else { |
} else { |
71 |
} |
} |
72 |
} |
} |
73 |
|
|
74 |
return '<code>' . $self->pipe . '</code>' . $out; |
warn "# pipe ", $self->title; |
75 |
|
|
76 |
|
return $out; |
77 |
} |
} |
78 |
|
|
79 |
1; |
1; |