lib/Catalyst/Script/Create.pm

filter: Statementstmt 95.8% 23 / 24 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 1 totaltotal 91.1% 31 / 34 CC 3 SCAR 6.9
CC
3
Cov
96%
run
3.0
_build_helper_class
2.0
BEGIN
1.0
CRAP 2.0
« lib/Catalyst/Response/Writer.pm ↑ Summary lib/Catalyst/ActionContainer.pm »
1 package Catalyst::Script::Create;
2 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use Class::Load 'load_class';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use namespace::clean -except => [ 'meta' ];
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 with 'Catalyst::ScriptRole';
7  
8 2 has force => (
9 traits => [qw(Getopt)],
10 cmd_aliases => 'nonew',
11 isa => 'Bool',
12 is => 'ro',
13 documentation => 'Force new scripts',
14 );
15  
16 2 has debug => (
17 traits => [qw(Getopt)],
18 cmd_aliases => 'd',
19 isa => 'Bool',
20 is => 'ro',
21 documentation => 'Force debug mode',
22 );
23  
24 2 has mechanize => (
25 traits => [qw(Getopt)],
26 cmd_aliases => 'mech',
27 isa => 'Bool',
28 is => 'ro',
29 documentation => 'use WWW::Mechanize',
30 );
31  
32 2 has helper_class => (
33 isa => 'Str',
34 is => 'ro',
35 builder => '_build_helper_class',
36 );
37  
38 0 ▶sub _build_helper_class { 'Catalyst::Helper' }
Subroutine _build_helper_class: not called CC=1 SCAR=6.9
39  
40 3 ▶sub run {
Subroutine run: called CC=3 SCAR=11.0
Pod undocumented
41 3 my ($self) = @_;
42  
43 3 ▶ $self->print_usage_text if !$self->ARGV->[0];
Branch: 1 branch
BranchTrueFalseTotal
unless $self->ARGV->[0] 1 2 3
44  
45 3 my $helper_class = $self->helper_class;
46 3 load_class($helper_class);
47 3 my $helper = $helper_class->new( { '.newfiles' => !$self->force, mech => $self->mechanize } );
48  
49 3 ▶ $self->print_usage_text unless $helper->mk_component( $self->application_name, @{$self->extra_argv} );
Branch: 1 branch
BranchTrueFalseTotal
unless $helper->mk_component($self->application_name, @{$self->extra_argv;}) 1 2 3
50  
51 }
52  
53 2 __PACKAGE__->meta->make_immutable;
54 2 1;
55  
56 =head1 NAME
57  
58 Catalyst::Script::Create - Create a new Catalyst Component
59  
60 =head1 SYNOPSIS
61  
62 myapp_create.pl [options] model|view|controller name [helper] [options]
63  
64 Options:
65 --force don't create a .new file where a file to be created exists
66 --mechanize use Test::WWW::Mechanize::Catalyst for tests if available
67 --help display this help and exits
68  
69 Examples:
70 myapp_create.pl controller My::Controller
71 myapp_create.pl controller My::Controller BindLex
72 myapp_create.pl --mechanize controller My::Controller
73 myapp_create.pl view My::View
74 myapp_create.pl view MyView TT
75 myapp_create.pl view TT TT
76 myapp_create.pl model My::Model
77 myapp_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\
78 dbi:SQLite:/tmp/my.db
79 myapp_create.pl model AnotherDB DBIC::Schema MyApp::Schema create=static\
80 dbi:Pg:dbname=foo root 4321
81  
82 See also:
83 perldoc Catalyst::Manual
84 perldoc Catalyst::Manual::Intro
85  
86 =head1 DESCRIPTION
87  
88 Create a new Catalyst Component.
89  
90 Existing component files are not overwritten. If any of the component files
91 to be created already exist the file will be written with a '.new' suffix.
92 This behavior can be suppressed with the C<--force> option.
93  
94 =head1 SEE ALSO
95  
96 L<Catalyst::ScriptRunner>
97  
98 =head1 AUTHORS
99  
100 Catalyst Contributors, see Catalyst.pm
101  
102 =head1 COPYRIGHT
103  
104 This library is free software, you can redistribute it and/or modify
105 it under the same terms as Perl itself.
106  
107 =cut
108  
« lib/Catalyst/Response/Writer.pm ↑ Summary lib/Catalyst/ActionContainer.pm »