<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package Catalyst::Script::Create;
use Moose;
use Class::Load 'load_class';
use namespace::autoclean;

with 'Catalyst::ScriptRole';

has force =&gt; (
    traits        =&gt; [qw(Getopt)],
    cmd_aliases   =&gt; 'nonew',
    isa           =&gt; 'Bool',
    is            =&gt; 'ro',
    documentation =&gt; 'Force new scripts',
);

has debug =&gt; (
    traits        =&gt; [qw(Getopt)],
    cmd_aliases   =&gt; 'd',
    isa           =&gt; 'Bool',
    is            =&gt; 'ro',
    documentation =&gt; 'Force debug mode',
);

has mechanize =&gt; (
    traits        =&gt; [qw(Getopt)],
    cmd_aliases   =&gt; 'mech',
    isa           =&gt; 'Bool',
    is            =&gt; 'ro',
    documentation =&gt; 'use WWW::Mechanize',
);

has helper_class =&gt; (
    isa     =&gt; 'Str',
    is      =&gt; 'ro',
    builder =&gt; '_build_helper_class',
);

sub _build_helper_class { 'Catalyst::Helper' }

sub run {
    my ($self) = @_;

    $self-&gt;print_usage_text if !$self-&gt;ARGV-&gt;[0];

    my $helper_class = $self-&gt;helper_class;
    load_class($helper_class);
    my $helper = $helper_class-&gt;new( { '.newfiles' =&gt; !$self-&gt;force, mech =&gt; $self-&gt;mechanize } );

    $self-&gt;print_usage_text unless $helper-&gt;mk_component( $self-&gt;application_name, @{$self-&gt;extra_argv} );

}

__PACKAGE__-&gt;meta-&gt;make_immutable;
1;

=head1 NAME

Catalyst::Script::Create - Create a new Catalyst Component

=head1 SYNOPSIS

 myapp_create.pl [options] model|view|controller name [helper] [options]

 Options:
   --force        don't create a .new file where a file to be created exists
   --mechanize    use Test::WWW::Mechanize::Catalyst for tests if available
   --help         display this help and exits

 Examples:
   myapp_create.pl controller My::Controller
   myapp_create.pl controller My::Controller BindLex
   myapp_create.pl --mechanize controller My::Controller
   myapp_create.pl view My::View
   myapp_create.pl view MyView TT
   myapp_create.pl view TT TT
   myapp_create.pl model My::Model
   myapp_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\
   dbi:SQLite:/tmp/my.db
   myapp_create.pl model AnotherDB DBIC::Schema MyApp::Schema create=static\
   dbi:Pg:dbname=foo root 4321

 See also:
   perldoc Catalyst::Manual
   perldoc Catalyst::Manual::Intro

=head1 DESCRIPTION

Create a new Catalyst Component.

Existing component files are not overwritten.  If any of the component files
to be created already exist the file will be written with a '.new' suffix.
This behavior can be suppressed with the C&lt;--force&gt; option.

=head1 SEE ALSO

L&lt;Catalyst::ScriptRunner&gt;

=head1 AUTHORS

Catalyst Contributors, see Catalyst.pm

=head1 COPYRIGHT

This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut

</pre></body></html>