App/lcpan/Cmd/stats_last_index_time.pm

filter: Statementstmt 59.2% 16 / 27 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 62.5% 20 / 32 CC 1 SCAR 2.2
CC
1
Cov
59%
handle_cmd
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« App/lcpan/Cmd/dist_rdeps.pm ↑ Summary App/lcpan/Cmd/author_mods_by_other_author_rdep_count.pm »
1 package App::lcpan::Cmd::stats_last_index_time;
2  
3 1 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 require App::lcpan;
8  
9 1 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
10 1 our $DATE = '2023-09-26'; # DATE
11 1 our $DIST = 'App-lcpan'; # DIST
12 1 our $VERSION = '1.074'; # VERSION
13  
14 1 our %SPEC;
15  
16 $SPEC{handle_cmd} = {
17 1 v => 1.1,
18 summary => 'Return last index time of mirror',
19 description => <<'_',
20  
21 This is mostly to support <pm:App::lcpan::Call>. See also `stats` subcommand
22 which gives a more complete statistics, but can be much slower.
23  
24 _
25 args => {
26 %App::lcpan::common_args,
27 },
28 };
29 0 ▶sub handle_cmd {
Subroutine handle_cmd: not called CC=1 SCAR=6.9
Pod documented
30 0 my %args = @_;
31  
32 0 my $state = App::lcpan::_init(\%args, 'ro');
33 0 my $dbh = $state->{dbh};
34  
35 0 my $stat = {};
36  
37 {
38 0 my ($time) = $dbh->selectrow_array("SELECT value FROM meta WHERE name='last_index_time'");
39 0 $stat->{raw_last_index_time} = $time;
40 0 $stat->{last_index_time} = App::lcpan::_fmt_time($time);
41  
42 # extra information
43 0 $stat->{cpan} = $state->{cpan};
44 0 $stat->{index_name} = $state->{index_name};
45 }
46  
47 0 [200, "OK", $stat];
48 }
49  
50 1 1;
51 # ABSTRACT: Return last index time of mirror
52  
53 __END__
« App/lcpan/Cmd/dist_rdeps.pm ↑ Summary App/lcpan/Cmd/author_mods_by_other_author_rdep_count.pm »