File Coverage

blib/lib/CPAN/Distrostatus.pm
Criterion Covered Total %
statement 20 23 86.9
branch 3 6 50.0
condition n/a
subroutine 7 9 77.7
pod 0 6 0.0
total 30 44 68.1


line stmt bran cond sub pod time code
1             # -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*-
2             # vim: ts=4 sts=4 sw=4:
3             package CPAN::Distrostatus;
4 22         277 use overload '""' => "as_string",
5 22     22   8060 fallback => 1;
  22         24273  
6 22     22   4796 use vars qw($something_has_failed_at);
  22         48  
  22         1352  
7 22         6809 use vars qw(
8             $VERSION
9 22     22   124 );
  22         61  
10             $VERSION = "5.5";
11              
12              
13             sub new {
14 21     21 0 329 my($class,$arg) = @_;
15 21         219 my $failed = substr($arg,0,2) eq "NO";
16 21 100       174 if ($failed) {
17 4         45 $something_has_failed_at = $CPAN::CurrentCommandId;
18             }
19             bless {
20 21         1193 TEXT => $arg,
21             FAILED => $failed,
22             COMMANDID => $CPAN::CurrentCommandId,
23             TIME => time,
24             }, $class;
25             }
26             sub something_has_just_failed () {
27 0 0   0 0 0 defined $something_has_failed_at &&
28             $something_has_failed_at == $CPAN::CurrentCommandId;
29             }
30 0     0 0 0 sub commandid { shift->{COMMANDID} }
31 7     7 0 92 sub failed { shift->{FAILED} }
32             sub text {
33 25     25 0 66 my($self,$set) = @_;
34 25 50       95 if (defined $set) {
35 0         0 $self->{TEXT} = $set;
36             }
37 25         350 $self->{TEXT};
38             }
39             sub as_string {
40 25     25 0 86 my($self) = @_;
41 25         100 $self->text;
42             }
43              
44              
45             1;