File Coverage

blib/lib/Acme/PricelessMethods.pm
Criterion Covered Total %
statement 28 28 100.0
branch 3 8 37.5
condition n/a
subroutine 10 10 100.0
pod 7 7 100.0
total 48 53 90.5


line stmt bran cond sub pod time code
1             package Acme::PricelessMethods;
2              
3 1     1   24125 use 5.006;
  1         4  
  1         31  
4 1     1   5 use warnings;
  1         2  
  1         26  
5 1     1   4 use strict;
  1         5  
  1         300  
6              
7             our $VERSION = '0.01';
8              
9             # ###### Implementation ###########
10              
11             sub new {
12 1     1 1 188 my $self = shift;
13              
14 1         4 my $object = { universe => 1 };
15              
16 1         3 return bless $object, $self;
17             }
18              
19             sub is_perl_installed {
20 1     1 1 774 my $self = shift;
21              
22             # let's check if perl is somewhere around here...
23 1 50       9 return 1 if defined $^X;
24             }
25              
26             sub is_machine_on {
27 1     1 1 2 my $self = shift;
28              
29             # indeed, it won't return the proper 1,
30             # but hey, it's the thought that counts
31 1 0       11 return 1 if return 1;
32             }
33              
34             sub universe_still_exists {
35 1     1 1 3 my $self = shift;
36              
37             # check if universe still exists
38 1 50       10 return 1 if defined $self->{'universe'};
39             }
40              
41             sub is_program_running {
42 1     1 1 3 my $self = shift;
43              
44             # we're assuming that if the version of the interpreter is defined,
45             # it's for a good reason
46 1 50       6 return 1 if defined $^V;
47             }
48              
49             sub is_time_moving_forward {
50 1     1 1 2 my $self = shift;
51              
52             # time probably is moving forward, but one can never be too sure
53 1         7 my $before = time;
54 1         2000142 sleep 2;
55 1         8 my $after = time;
56              
57 1         14 return $after - $before;
58             }
59              
60             sub is_true_true {
61 1     1 1 3 my $self = shift;
62              
63             # if 1 is true, we return 1
64 1         3 if (1) {
65 1         5 return 1;
66             }
67             # if 1 is not true, we return false, which is 1
68             else {
69             return 1;
70             }
71             }
72              
73             1; # Magic true value required at end of module
74              
75             __END__