line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
427556
|
use 5.014; # because we use the 'state' and 'non-destructive substitution' feature (s///r) |
|
1
|
|
|
|
|
21
|
|
2
|
1
|
|
|
1
|
|
16
|
use strict; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
56
|
|
3
|
1
|
|
|
1
|
|
19
|
use warnings; |
|
1
|
|
|
|
|
16
|
|
|
1
|
|
|
|
|
184
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Banal::Dist::Util::Pause; |
6
|
|
|
|
|
|
|
# vim: set ts=2 sts=2 sw=2 tw=115 et : |
7
|
|
|
|
|
|
|
# ABSTRACT: General purpose utility collection for |
8
|
|
|
|
|
|
|
# KEYWORDS: author utility |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.004'; |
11
|
|
|
|
|
|
|
# AUTHORITY |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
878
|
use Path::Tiny; |
|
1
|
|
|
|
|
12836
|
|
|
1
|
|
|
|
|
117
|
|
14
|
1
|
|
|
1
|
|
586
|
use namespace::autoclean; |
|
1
|
|
|
|
|
18404
|
|
|
1
|
|
|
|
|
4
|
|
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
|
|
7
|
use Exporter::Shiny qw( |
17
|
|
|
|
|
|
|
pause_config |
18
|
1
|
|
|
1
|
|
474
|
); |
|
1
|
|
|
|
|
4121
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# return username, password from ~/.pause |
21
|
|
|
|
|
|
|
sub pause_config |
22
|
|
|
|
|
|
|
{ |
23
|
|
|
|
|
|
|
# my $home = $ENV{HOME}; |
24
|
|
|
|
|
|
|
# return unless defined $home; |
25
|
|
|
|
|
|
|
# my $file = path($home, '.pause')->realpath; |
26
|
|
|
|
|
|
|
# # my $file = path('~/.pause')->realpath; |
27
|
|
|
|
|
|
|
# return unless $file->exists(); |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
0
|
0
|
|
my %r; |
30
|
|
|
|
|
|
|
FILE: |
31
|
0
|
|
|
|
|
|
foreach my $fname (qw(~/.pause ~/.pause.conf)) { |
32
|
0
|
|
|
|
|
|
my $file = path($fname)->realpath; |
33
|
0
|
0
|
|
|
|
|
next FILE unless $file->exists; |
34
|
|
|
|
|
|
|
LINE: |
35
|
0
|
|
|
|
|
|
foreach ( $file->lines(chomp=>1) ) { |
36
|
|
|
|
|
|
|
KEY: |
37
|
0
|
|
|
|
|
|
foreach my $key (qw(user password)) { |
38
|
0
|
0
|
|
|
|
|
m/^\s*${key}\s*(\s|[=])\s*(\S+)/ and do { $r{$key} = $1; next }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
0
|
0
|
|
|
|
|
wantarray ? (%r) : \%r; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |