blib/lib/Venus/Task/Venus/Get.pm

filter: Statementstmt 94.1% 32 / 34 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 8 / 10 Podpod 100% 3 / 3 totaltotal 89.8% 44 / 49 CC 2 SCAR 3.1
CC
2
Cov
92%
perform
2.0
name
2.0
footer
2.0
CRAP 1.4
« blib/lib/Venus/Kind/Value.pm ↑ Summary blib/lib/Venus/Role/Dumpable.pm »
1 package Venus::Task::Venus::Get;
2  
3 2 ▶use 5.018;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use Venus::Class 'base';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # IMPORTS
11  
12 2 ▶use Venus::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use Venus::Hash;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 # INHERITS
16  
17 2 base 'Venus::Task::Venus';
18  
19 # REQUIRES
20  
21 2 require Venus;
22  
23 # METHODS
24  
25 0 ▶sub name {
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
26 0 'vns get'
27 }
28  
29 0 ▶sub footer {
Subroutine footer: not called CC=1 SCAR=6.9
Pod documented
30  
31 0 return <<"EOF";
32 Copyright 2022-2023, Vesion $Venus::VERSION, The Venus "AUTHOR" and "CONTRIBUTORS"
33  
34 More information on "vns" and/or the "Venus" standard library, visit
35 https://p3rl.org/vns.
36 EOF
37 }
38  
39 2 ▶sub perform {
Subroutine perform: called CC=2 SCAR=7.0
40 2 my ($self) = @_;
41  
42 2 my $file = $self->file;
43 2 my $path = $self->argument_value('path');
44  
45 2 my $config = Venus::Hash->new(Venus::Config->read_file($file)->value);
46  
47 2 my ($value) = $config->gets($path);
48  
49 2 ▶ $self->log_info($value) if defined $value;
Branch: 1 branch
BranchTrueFalseTotal
if defined $value 2 0 2
50  
51 2 return $self;
52 }
53  
54 3 ▶sub prepare {
Subroutine prepare: called CC=1 SCAR=0.0
Pod documented
55 3 my ($self) = @_;
56  
57 3 $self->summary('get values in the Venus configuration file');
58  
59 # path
60 3 $self->argument('path', {
61 name => 'path',
62 help => 'Value path. Use dot-natotion. E.g. "perl.repl".',
63 range => '0',
64 multiples => 0,
65 required => 1,
66 type => 'string',
67 wants => 'string',
68 });
69  
70 # help
71 3 $self->option('help', {
72 name => 'help',
73 help => 'Display the help text.',
74 multiples => 0,
75 required => 0,
76 type => 'boolean',
77 wants => 'boolean',
78 });
79  
80 3 return $self;
81 }
82  
83 2 1;
84  
85  
86 =head1 NAME
87  
88 Venus::Task::Venus::Get - vns get
89  
90 =cut
91  
92 =head1 ABSTRACT
93  
94 Task Class for Venus CLI
95  
96 =cut
97  
98 =head1 SYNOPSIS
99  
100 use Venus::Task::Venus::Get;
101  
102 my $task = Venus::Task::Venus::Get->new;
103  
104 # bless(..., "Venus::Task::Venus::Get")
105  
106 =cut
107  
108 =head1 DESCRIPTION
109  
110 This package is a task class for the C<vns-get> CLI, and C<vns get>
111 sub-command.
112  
113 =cut
114  
115 =head1 INHERITS
116  
117 This package inherits behaviors from:
118  
119 L<Venus::Task::Venus>
120  
121 =cut
122  
123 =head1 METHODS
124  
125 This package provides the following methods:
126  
127 =cut
128  
129 =head2 new
130  
131 new(any @args) (Venus::Task::Venus::Get)
132  
133 The new method constructs an instance of the package.
134  
135 I<Since C<4.15>>
136  
137 =over 4
138  
139 =item new example 1
140  
141 package main;
142  
143 use Venus::Task::Venus::Get;
144  
145 my $task = Venus::Task::Venus::Get->new;
146  
147 # bless({...}, 'Venus::Task::Venus::Get')
148  
149 =back
150  
151 =cut
152  
153 =head2 perform
154  
155 perform() (Venus::Task::Venus::Get)
156  
157 The perform method executes the CLI logic.
158  
159 I<Since C<4.15>>
160  
161 =over 4
162  
163 =item perform example 1
164  
165 # given: synopsis
166  
167 package main;
168  
169 $task->prepare;
170  
171 $task->parse('perl.perl');
172  
173 my $perform = $task->perform;
174  
175 # bless(.., 'Venus::Task::Venus::Get')
176  
177 =back
178  
179 =over 4
180  
181 =item perform example 2
182  
183 # given: synopsis
184  
185 package main;
186  
187 $task->prepare;
188  
189 $task->parse('perl.prove');
190  
191 my $perform = $task->perform;
192  
193 # bless(.., 'Venus::Task::Venus::Get')
194  
195 =back
196  
197 =cut
198  
199 =head1 AUTHORS
200  
201 Awncorp, C<awncorp@cpan.org>
202  
203 =cut
204  
205 =head1 LICENSE
206  
207 Copyright (C) 2022, Awncorp, C<awncorp@cpan.org>.
208  
209 This program is free software, you can redistribute it and/or modify it under
210 the terms of the Apache license version 2.0.
211  
212 =cut
« blib/lib/Venus/Kind/Value.pm ↑ Summary blib/lib/Venus/Role/Dumpable.pm »