Commit | Line | Data |
0ba6e8aa |
1 | package Catalyst::Script::Test; |
accb0640 |
2 | use Moose; |
451b2a44 |
3 | use Pod::Usage; |
4 | use FindBin; |
5 | use lib "$FindBin::Bin/../lib"; |
6 | with 'MooseX::Getopt'; |
4e45780e |
7 | use MooseX::Types::Moose qw/Str Bool/; |
d9a32f71 |
8 | use namespace::autoclean; |
451b2a44 |
9 | |
410d96eb |
10 | #extends qw(MooseX::App::Cmd); |
11 | |
d9a32f71 |
12 | has _app => ( |
13 | reader => 'app', |
14 | init_arg => 'app', |
15 | traits => [qw(NoGetopt)], |
73e4f0f1 |
16 | isa => Str, |
d9a32f71 |
17 | is => 'ro', |
18 | ); |
19 | |
20 | has help => ( |
21 | traits => [qw(Getopt)], |
22 | cmd_aliases => 'h', |
73e4f0f1 |
23 | isa => Bool, |
d9a32f71 |
24 | is => 'ro', |
25 | documentation => qq{ display this help and exits }, |
26 | ); |
451b2a44 |
27 | |
28 | |
29 | sub run { |
30 | my $self = shift; |
31 | |
32 | Class::MOP::load_class("Catalyst::Test"); |
33 | Catalyst::Test->import($self->app); |
57dc50b0 |
34 | |
451b2a44 |
35 | pod2usage(1) if ( $self->help || !$ARGV[1] ); |
36 | print request($ARGV[1])->content . "\n"; |
57dc50b0 |
37 | |
451b2a44 |
38 | } |
39 | |
73e4f0f1 |
40 | |
d6e8e664 |
41 | __PACKAGE__->meta->make_immutable; |
0ba6e8aa |
42 | 1; |