| 1 | package Punk::Command::Fakecmd; | ||||||||||
| 2 | |||||||||||
| 3 | # t/1311's plugin-seam fixture: bin/punk probes Punk::Command::<Ucfirst> on an | ||||||||||
| 4 | # unknown command, and loading the module IS the registration. | ||||||||||
| 5 | |||||||||||
| 6 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use Punk::Command (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | Punk::Command->register(fakecmd => { | ||||||||||
| 11 | abstract => 'a test fixture', | ||||||||||
| 12 | hidden => 1, | ||||||||||
| 13 | options => [ { spec => 'shout', doc => 'upper case' } ], | ||||||||||
| 14 | 0 | ▶ | code => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 15 | 0 | my ($opt) = @_; | |||||||||
| 16 | 0 | ▶ | print $opt->{shout} ? "FAKE\n" : "fake\n"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | 0 | return 42; | |||||||||
| 18 | }, | ||||||||||
| 19 | 2 | }, __PACKAGE__); | |||||||||
| 20 | |||||||||||
| 21 | # A doctor row, so t/1311 can prove `punk doctor` finds a plugin's row | ||||||||||
| 22 | # without that plugin's command having been named first. | ||||||||||
| 23 | 2 | ▶ | Punk::Command->register_doctor('Fakecmd' => sub { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 2 | return (1, 'the fixture is installed'); | |||||||||
| 25 | 2 | ▶ | }, __PACKAGE__) if Punk::Command->can('register_doctor'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | |||||||||||
| 27 | 2 | 1; | |||||||||