line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Usul::Config::Programs; |
2
|
|
|
|
|
|
|
|
3
|
19
|
|
|
19
|
|
13119
|
use namespace::autoclean; |
|
19
|
|
|
|
|
57
|
|
|
19
|
|
|
|
|
127
|
|
4
|
|
|
|
|
|
|
|
5
|
19
|
|
|
19
|
|
1501
|
use Class::Usul::Constants qw( TRUE UMASK ); |
|
19
|
|
|
|
|
54
|
|
|
19
|
|
|
|
|
184
|
|
6
|
19
|
|
|
19
|
|
11757
|
use Class::Usul::File; |
|
19
|
|
|
|
|
54
|
|
|
19
|
|
|
|
|
490
|
|
7
|
19
|
|
|
|
|
163
|
use Class::Usul::Types qw( ArrayRef Bool HashRef NonEmptySimpleStr |
8
|
19
|
|
|
19
|
|
93
|
NonZeroPositiveInt PositiveInt ); |
|
19
|
|
|
|
|
40
|
|
9
|
19
|
|
|
19
|
|
29907
|
use Config; |
|
19
|
|
|
|
|
53
|
|
|
19
|
|
|
|
|
690
|
|
10
|
19
|
|
|
19
|
|
95
|
use File::Basename qw( basename ); |
|
19
|
|
|
|
|
39
|
|
|
19
|
|
|
|
|
837
|
|
11
|
19
|
|
|
19
|
|
98
|
use File::DataClass::Types qw( Path OctalNum ); |
|
19
|
|
|
|
|
37
|
|
|
19
|
|
|
|
|
116
|
|
12
|
19
|
|
|
19
|
|
24213
|
use File::HomeDir; |
|
19
|
|
|
|
|
40
|
|
|
19
|
|
|
|
|
856
|
|
13
|
19
|
|
|
19
|
|
111
|
use Moo; |
|
19
|
|
|
|
|
39
|
|
|
19
|
|
|
|
|
113
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
extends q(Class::Usul::Config); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Attribute constructors |
18
|
|
|
|
|
|
|
my $_build_os = sub { |
19
|
2
|
|
|
2
|
|
46
|
my $self = shift; |
20
|
2
|
|
|
|
|
60
|
my $file = 'os_'.$Config{osname}.$self->extension; |
21
|
2
|
50
|
|
|
|
96
|
my $path = $self->ctrldir->catfile( $file ); $path->exists or return {}; |
|
2
|
|
|
|
|
2139
|
|
22
|
0
|
|
|
|
|
0
|
my $conf = Class::Usul::File->data_load( paths => [ $path ] ); |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
0
|
|
|
0
|
return $conf->{os} // {}; |
25
|
|
|
|
|
|
|
}; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $_build_owner = sub { |
28
|
1
|
|
50
|
1
|
|
1276
|
return $_[ 0 ]->inflate_symbol( $_[ 1 ], 'prefix' ) || 'root'; |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $_build_script = sub { |
32
|
2
|
|
|
2
|
|
2662
|
return basename( $_[ 0 ]->inflate_path( $_[ 1 ], 'pathname' ) ); |
33
|
|
|
|
|
|
|
}; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Public attributes |
36
|
|
|
|
|
|
|
has 'doc_title' => is => 'ro', isa => NonEmptySimpleStr, |
37
|
|
|
|
|
|
|
default => 'User Contributed Documentation'; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
has 'man_page_cmd' => is => 'ro', isa => ArrayRef, |
40
|
23
|
|
|
23
|
|
21217
|
builder => sub { [ 'nroff', '-man' ] }; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has 'my_home' => is => 'lazy', isa => Path, coerce => TRUE, |
43
|
1
|
|
|
1
|
|
28
|
builder => sub { File::HomeDir->my_home }; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
has 'os' => is => 'lazy', isa => HashRef, builder => $_build_os; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
has 'owner' => is => 'lazy', isa => NonEmptySimpleStr, |
48
|
|
|
|
|
|
|
builder => $_build_owner; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has 'pwidth' => is => 'ro', isa => NonZeroPositiveInt, default => 60; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
has 'script' => is => 'lazy', isa => NonEmptySimpleStr, |
53
|
|
|
|
|
|
|
builder => $_build_script; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has 'umask' => is => 'ro', isa => OctalNum, coerce => TRUE, |
56
|
|
|
|
|
|
|
default => UMASK; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=pod |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 Name |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Class::Usul::Config::Programs - Additional configuration attributes for CLI programs |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 Synopsis |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
package Class::Usul::Programs; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
use Moo; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
extends q(Class::Usul); |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
has '+config_class' => default => q(Class::Usul::Config::Programs); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 Description |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Additional configuration attributes for CLI programs |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 Configuration and Environment |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Defines the following list of attributes |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=over 3 |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item C<cache_ttys> |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Boolean defaults to true. Passed to the L<Proc::ProcessTable> constructor |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item C<doc_title> |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
String defaults to 'User Contributed Documentation'. Used in the Unix man |
95
|
|
|
|
|
|
|
pages |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item C<man_page_cmd> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Array ref containing the command and options to produce a man page. Defaults |
100
|
|
|
|
|
|
|
to C<man -nroff> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item C<my_home> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
A directory object reference which defaults to the users home |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item C<os> |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
A hash reference loaded from from a file selected by OS name. The file is named |
109
|
|
|
|
|
|
|
like F<os_linux.json> and can be found in the configuration C<ctrldir> |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item C<owner> |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
String. Name of the application file owner |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item C<pwidth> |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Integer. Number of characters used to justify command line prompts |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item C<script> |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
String. The basename of the C<pathname> attribute |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item C<umask> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Octal number defaults to the constant C<UMASK>. The default file creation mask |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=back |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 Subroutines/Methods |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
None |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 Diagnostics |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
None |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 Dependencies |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=over 3 |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item L<Class::Usul::Config> |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item L<Class::Usul::File> |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item L<Moo> |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=back |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 Incompatibilities |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
There are no known incompatibilities in this module |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 Bugs and Limitations |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
There are no known bugs in this module. |
156
|
|
|
|
|
|
|
Please report problems to the address below. |
157
|
|
|
|
|
|
|
Patches are welcome |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 Acknowledgements |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Larry Wall - For the Perl programming language |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=head1 Author |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Peter Flanigan, C<< <pjfl@cpan.org> >> |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 License and Copyright |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Copyright (c) 2017 Peter Flanigan. All rights reserved |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
172
|
|
|
|
|
|
|
under the same terms as Perl itself. See L<perlartistic> |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, |
175
|
|
|
|
|
|
|
but WITHOUT WARRANTY; without even the implied warranty of |
176
|
|
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=cut |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
# Local Variables: |
181
|
|
|
|
|
|
|
# mode: perl |
182
|
|
|
|
|
|
|
# tab-width: 3 |
183
|
|
|
|
|
|
|
# End: |