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 | |
d9a32f71 |
10 | has _app => ( |
11 | reader => 'app', |
12 | init_arg => 'app', |
13 | traits => [qw(NoGetopt)], |
14 | isa => 'Str', |
15 | is => 'ro', |
16 | ); |
17 | |
18 | has help => ( |
19 | traits => [qw(Getopt)], |
20 | cmd_aliases => 'h', |
21 | isa => 'Bool', |
22 | is => 'ro', |
23 | documentation => qq{ display this help and exits }, |
24 | ); |
451b2a44 |
25 | |
26 | |
27 | sub run { |
28 | my $self = shift; |
29 | |
30 | Class::MOP::load_class("Catalyst::Test"); |
31 | Catalyst::Test->import($self->app); |
57dc50b0 |
32 | |
451b2a44 |
33 | pod2usage(1) if ( $self->help || !$ARGV[1] ); |
34 | print request($ARGV[1])->content . "\n"; |
57dc50b0 |
35 | |
451b2a44 |
36 | } |
37 | |
d6e8e664 |
38 | no Moose; |
39 | __PACKAGE__->meta->make_immutable; |
0ba6e8aa |
40 | 1; |