P5U/Command/DebianRelease.pm untested

filter: Statementstmt 0.0% 0 / 35 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 61 CC 4 SCAR 19.7
CC
4
Cov
0%
execute
20.0
BEGIN
2.0
command_names
2.0
CRAP 7.1
1 package P5U::Command::DebianRelease;
2  
3 use 5.010;
4 use strict;
5 use utf8;
6 use P5U-command;
7  
8 BEGIN {
9 $P5U::Command::DebianRelease::AUTHORITY = 'cpan:TOBYINK';
10 $P5U::Command::DebianRelease::VERSION = '0.100';
11 };
12  
13 use constant {
14 abstract => q[show distribution version in Debian unstable],
15 usage_desc => q[%c debian-release %o Distribution|CPANID],
16 };
17  
18 use constant description => <<'DESCRIPTION';
19 This command shows which Perl distributions are available in Debian
20 unstable. The version numbers of the latest CPAN release and the latest
21 Debian package are shown side-by-side, and when Debian is not up to date,
22 two exclamation marks are shown.
23  
24 Examples:
25 p5u debian-release Task-Weaken
26 p5u debian-release -a ADAMK
27  
28 DESCRIPTION
29  
30 sub command_names
31 {
32 qw(
33 debian-release
34 debian
35 dr
36 );
37 }
38  
39 sub opt_spec
40 {
41 return (
42 ["author|a", "query is an author"],
43 ["distribution|d", "query is a distribution (default)"],
44 )
45 }
46  
47 sub execute
48 {
49 require P5U::Lib::DebianRelease;
50
51 my ($self, $opt, $args) = @_;
52
53 $self->usage_error("You must provide a distribution or author name.")
54 unless @$args;
55 $self->usage_error("Cannot request both author and distribution report.")
56 if $opt->{author} && $opt->{distribution};
57
58 my $helper = P5U::Lib::DebianRelease::->new(
59 cache_file => $self->get_cachedir->child('allpackages.cache'),
60 );
61
62 if ($opt->{author})
63 { print $helper->author_report($_) for @$args }
64 else
65 { print $helper->distribution_report($_) for @$args }
66 }
67  
68 1;