| 1 | package Linux::Virt::Plugin; | ||
| 2 | { | ||
| 3 | 2 | $Linux::Virt::Plugin::VERSION = '0.15'; | |
| 4 | } | ||
| 5 | 2 | ▶ | BEGIN { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 2 | $Linux::Virt::Plugin::AUTHORITY = 'cpan:TEX'; | |
| 7 | } | ||
| 8 | # ABSTRACT: baseclass for an Linux::Virt plugin | ||
| 9 | |||
| 10 | 2 | ▶ | use 5.010_000; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 2 | ▶ | use mro 'c3'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 2 | ▶ | use feature ':5.10'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | 2 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 2 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | # use IO::Handle; | ||
| 18 | # use autodie; | ||
| 19 | # use MooseX::Params::Validate; | ||
| 20 | # use Carp; | ||
| 21 | # use English qw( -no_match_vars ); | ||
| 22 | # use Try::Tiny; | ||
| 23 | |||
| 24 | 2 | ▶ | use Sys::FS; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 25 | 2 | ▶ | use Sys::Run; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 26 | |||
| 27 | # extends ... | ||
| 28 | # has ... | ||
| 29 | 2 | has 'sys' => ( | |
| 30 | 'is' => 'rw', | ||
| 31 | 'isa' => 'Sys::Run', | ||
| 32 | 'lazy' => 1, | ||
| 33 | 'builder' => '_init_sys', | ||
| 34 | ); | ||
| 35 | |||
| 36 | 2 | has 'fs' => ( | |
| 37 | 'is' => 'rw', | ||
| 38 | 'isa' => 'Sys::FS', | ||
| 39 | 'lazy' => 1, | ||
| 40 | 'builder' => '_init_fs', | ||
| 41 | ); | ||
| 42 | |||
| 43 | 2 | has 'priority' => ( | |
| 44 | 'is' => 'ro', | ||
| 45 | 'isa' => 'Int', | ||
| 46 | 'lazy' => 1, | ||
| 47 | 'builder' => '_init_priority', | ||
| 48 | ); | ||
| 49 | # with ... | ||
| 50 | 2 | with qw(Config::Yak::RequiredConfig Log::Tree::RequiredLogger); | |
| 51 | # initializers ... | ||
| 52 | 0 | ▶ | sub _init_priority { return 0; } |
|
Subroutine
_init_priority: not called CC=1 SCAR=6.9
| |||
| 53 | |||
| 54 | 0 | ▶ | sub _init_sys { |
|
Subroutine
_init_sys: not called CC=1 SCAR=6.9
| |||
| 55 | 0 | my $self = shift; | |
| 56 | |||
| 57 | 0 | my $Sys = Sys::Run::->new( { 'logger' => $self->logger(), } ); | |
| 58 | |||
| 59 | 0 | return $Sys; | |
| 60 | } ## end sub _init_sys | ||
| 61 | |||
| 62 | 0 | ▶ | sub _init_fs { |
|
Subroutine
_init_fs: not called CC=1 SCAR=6.9
| |||
| 63 | 0 | my $self = shift; | |
| 64 | |||
| 65 | 0 | my $FS = Sys::FS::->new( | |
| 66 | { | ||
| 67 | 'logger' => $self->logger(), | ||
| 68 | 'sys' => $self->sys(), | ||
| 69 | } | ||
| 70 | ); | ||
| 71 | |||
| 72 | 0 | return $FS; | |
| 73 | } ## end sub _init_fs | ||
| 74 | |||
| 75 | # your code here ... | ||
| 76 | 0 | ▶ | sub is_host { |
|
Subroutine
is_host: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 77 | 0 | my $self = shift; | |
| 78 | |||
| 79 | 0 | return; | |
| 80 | } | ||
| 81 | |||
| 82 | 0 | ▶ | sub is_vm { |
|
Subroutine
is_vm: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 83 | 0 | my $self = shift; | |
| 84 | |||
| 85 | 0 | return; | |
| 86 | } | ||
| 87 | |||
| 88 | 0 | ▶ | sub is_running { |
|
Subroutine
is_running: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 89 | 0 | my $self = shift; | |
| 90 | |||
| 91 | 0 | return; | |
| 92 | } | ||
| 93 | |||
| 94 | 0 | ▶ | sub create { |
|
Subroutine
create: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 95 | 0 | my $self = shift; | |
| 96 | |||
| 97 | 0 | warn "This method is not implemented in this baseclass.\n"; | |
| 98 | |||
| 99 | 0 | return; | |
| 100 | } ## end sub create | ||
| 101 | |||
| 102 | ## no critic (ProhibitBuiltinHomonyms) | ||
| 103 | 0 | ▶ | sub delete { |
|
Subroutine
delete: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 104 | ## use critic | ||
| 105 | 0 | my $self = shift; | |
| 106 | |||
| 107 | 0 | warn "This method is not implemented in this baseclcass.\n"; | |
| 108 | |||
| 109 | 0 | return; | |
| 110 | } ## end sub delete | ||
| 111 | |||
| 112 | 0 | ▶ | sub vms { |
|
Subroutine
vms: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 113 | 0 | my $self = shift; | |
| 114 | |||
| 115 | 0 | warn "This method is not implemented in this baseclcass.\n"; | |
| 116 | |||
| 117 | 0 | return; | |
| 118 | } ## end sub vms | ||
| 119 | |||
| 120 | 0 | ▶ | sub start { |
|
Subroutine
start: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 121 | 0 | my $self = shift; | |
| 122 | |||
| 123 | 0 | warn "This method is not implemented in this baseclcass.\n"; | |
| 124 | |||
| 125 | 0 | return; | |
| 126 | } ## end sub start | ||
| 127 | |||
| 128 | 0 | ▶ | sub stop { |
|
Subroutine
stop: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 129 | 0 | my $self = shift; | |
| 130 | |||
| 131 | 0 | warn "This method is not implemented in this baseclcass.\n"; | |
| 132 | |||
| 133 | 0 | return; | |
| 134 | } ## end sub stop | ||
| 135 | |||
| 136 | 2 | ▶ | no Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 137 | 2 | __PACKAGE__->meta->make_immutable; | |
| 138 | |||
| 139 | 2 | 1; | |
| 140 | |||
| 141 | __END__ | ||