File Coverage

blib/lib/CPAN/Distrostatus.pm
Criterion Covered Total %
statement 9 23 39.1
branch 0 6 0.0
condition n/a
subroutine 3 9 33.3
pod 0 6 0.0
total 12 44 27.2


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 13         183 use overload '""' => "as_string",
5 13     13   5430 fallback => 1;
  13         3677  
6 13     13   1298 use vars qw($something_has_failed_at);
  13         25  
  13         649  
7 13         3201 use vars qw(
8             $VERSION
9 13     13   68 );
  13         24  
10             $VERSION = "5.5";
11              
12              
13             sub new {
14 0     0 0   my($class,$arg) = @_;
15 0           my $failed = substr($arg,0,2) eq "NO";
16 0 0         if ($failed) {
17 0           $something_has_failed_at = $CPAN::CurrentCommandId;
18             }
19             bless {
20 0           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   defined $something_has_failed_at &&
28             $something_has_failed_at == $CPAN::CurrentCommandId;
29             }
30 0     0 0   sub commandid { shift->{COMMANDID} }
31 0     0 0   sub failed { shift->{FAILED} }
32             sub text {
33 0     0 0   my($self,$set) = @_;
34 0 0         if (defined $set) {
35 0           $self->{TEXT} = $set;
36             }
37 0           $self->{TEXT};
38             }
39             sub as_string {
40 0     0 0   my($self) = @_;
41 0           $self->text;
42             }
43              
44              
45             1;