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 12         98 use overload '""' => "as_string",
5 12     12   3661 fallback => 1;
  12         3029  
6 12     12   890 use vars qw($something_has_failed_at);
  12         19  
  12         591  
7 12         2359 use vars qw(
8             $VERSION
9 12     12   43 );
  12         16  
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;