| 1 | package App::AutoCRUD::Controller::Gvascript; | ||
| 2 | |||
| 3 | use 5.010; | ||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | |||
| 7 | use Moose; | ||
| 8 | extends 'App::AutoCRUD::Controller'; | ||
| 9 | |||
| 10 | use Alien::GvaScript; | ||
| 11 | use namespace::clean -except => 'meta'; | ||
| 12 | |||
| 13 | sub serve { | ||
| 14 | my ($self) = @_; | ||
| 15 | |||
| 16 | my $context = $self->context; | ||
| 17 | my $path = $context->path; | ||
| 18 | my $file = Alien::GvaScript->path . "/" . $context->path; | ||
| 19 | -f $file | ||
| 20 | or die "GvaScript $path: not found"; | ||
| 21 | |||
| 22 | my $view_class = $context->app->find_class("View::Download") | ||
| 23 | or die "no Download view"; | ||
| 24 | $context->set_view($view_class->new); | ||
| 25 | |||
| 26 | return $file; | ||
| 27 | } | ||
| 28 | |||
| 29 | 1; | ||
| 30 | |||
| 31 | |||
| 32 | __END__ |