| 1 | 1 | ▶ | use v5.20; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use experimental qw( signatures lexical_subs postderef ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 0 | ▶ | use utf8::all; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 6 | |||
| 7 | package App::Chit; | ||
| 8 | |||
| 9 | use App::Cmd::Setup -app; | ||
| 10 | use App::Chit::Util (); | ||
| 11 | |||
| 12 | our $AUTHORITY = 'cpan:TOBYINK'; | ||
| 13 | our $VERSION = '0.001001'; | ||
| 14 | |||
| 15 | sub default_command { | ||
| 16 | return "chat"; | ||
| 17 | } | ||
| 18 | |||
| 19 | sub run ( $self, @args ) { | ||
| 20 | $self->usage_error( "Set the @{[ App::Chit::Util::CHIT_KEY_VAR() ]} environment variable" ) | ||
| 21 | unless $ENV{App::Chit::Util::CHIT_KEY_VAR()}; | ||
| 22 | $self->SUPER::run( @args ); | ||
| 23 | } | ||
| 24 | |||
| 25 | sub _prepare_command ( $self, $command, $opt, @args ) { | ||
| 26 | if ( my $plugin = $self->plugin_for( $command ) ) { | ||
| 27 | return $plugin->prepare( $self, @args ); | ||
| 28 | } | ||
| 29 | elsif ( length $command and App::Chit::Util::find_chit_dir() ) { | ||
| 30 | my $plugin = $self->plugin_for( $self->default_command ); | ||
| 31 | return $plugin->prepare( $self, $command, @args ); | ||
| 32 | } | ||
| 33 | else { | ||
| 34 | return $self->_bad_command( $command, $opt, @args ); | ||
| 35 | } | ||
| 36 | } | ||
| 37 | |||
| 38 | 1; | ||
| 39 | |||
| 40 | __END__ | ||