| 1 | 24 | ▶ | use 5.010001; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 24 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 24 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | package Mite::App::Command::preview; | ||||||||||
| 6 | 24 | ▶ | use Mite::Miteception -all; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 24 | extends qw(Mite::App::Command); | |||||||||
| 8 | |||||||||||
| 9 | 24 | our $AUTHORITY = 'cpan:TOBYINK'; | |||||||||
| 10 | 24 | our $VERSION = '0.013000'; | |||||||||
| 11 | |||||||||||
| 12 | 24 | ▶ | sub abstract { | ||||||||
|
Subroutine
abstract: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 13 | 24 | return "Preview the .mite.pm for a file."; | |||||||||
| 14 | } | ||||||||||
| 15 | |||||||||||
| 16 | 24 | ▶ | around _build_kingpin_command => sub { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 24 | my ( $next, $self, @args ) = @_; | |||||||||
| 18 | |||||||||||
| 19 | 24 | my $command = $self->$next( @args ); | |||||||||
| 20 | 24 | $command->arg( 'file', 'Path to file to preview.' )->required->existing_file; | |||||||||
| 21 | |||||||||||
| 22 | 24 | return $command; | |||||||||
| 23 | 24 | }; | |||||||||
| 24 | |||||||||||
| 25 | 0 | ▶ | sub execute { | ||||||||
|
Subroutine
execute: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 26 | 0 | my $self = shift; | |||||||||
| 27 | |||||||||||
| 28 | 0 | ▶ | return 0 if $self->should_exit_quietly; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | |||||||||||
| 30 | 0 | my $file = $self->kingpin_command->args->get( 'file' )->value; | |||||||||
| 31 | |||||||||||
| 32 | 0 | my $project = $self->project; | |||||||||
| 33 | 0 | $project->load_directory; | |||||||||
| 34 | |||||||||||
| 35 | $project->load_files( [ $file ], '.' ) | ||||||||||
| 36 | 0 | ▶ | unless $project->sources->{$file}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | |||||||||||
| 38 | 0 | my $source = $project->source_for( $file ); | |||||||||
| 39 | 0 | print $source->compile; | |||||||||
| 40 | |||||||||||
| 41 | 0 | return 0; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 24 | 1; | |||||||||