| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Diabetes::Glucose; |
|
2
|
1
|
|
|
1
|
|
1091
|
use Moose; |
|
|
1
|
|
|
|
|
321430
|
|
|
|
1
|
|
|
|
|
7
|
|
|
3
|
1
|
|
|
1
|
|
4990
|
use DateTime; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
15
|
|
|
4
|
1
|
|
|
1
|
|
607
|
use Data::Dumper; |
|
|
1
|
|
|
|
|
3867
|
|
|
|
1
|
|
|
|
|
153
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has 'stamp' => ( |
|
9
|
|
|
|
|
|
|
is => 'rw', |
|
10
|
|
|
|
|
|
|
isa => 'DateTime', |
|
11
|
|
|
|
|
|
|
lazy_build => 1, |
|
12
|
|
|
|
|
|
|
); |
|
13
|
|
|
|
|
|
|
|
|
14
|
0
|
|
|
0
|
|
0
|
sub _build_stamp { DateTime->now } |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has 'comment' => ( |
|
17
|
|
|
|
|
|
|
is => 'rw', |
|
18
|
|
|
|
|
|
|
isa => 'Str', |
|
19
|
|
|
|
|
|
|
); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has 'source' => ( |
|
22
|
|
|
|
|
|
|
is => 'rw', |
|
23
|
|
|
|
|
|
|
isa => 'Str' |
|
24
|
|
|
|
|
|
|
); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has ['mmol', 'mgdl'] => ( is => 'rw', isa => 'Num', required => 1 ); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub BUILDARGS { |
|
29
|
6
|
|
|
6
|
1
|
14
|
my( $self, %args ) = @_; |
|
30
|
|
|
|
|
|
|
|
|
31
|
6
|
100
|
|
|
|
14
|
if( exists $args{'mgdl'} ) { |
|
|
|
50
|
|
|
|
|
|
|
32
|
3
|
|
|
|
|
6
|
$args{'mmol'} = $args{'mgdl'} / 18.5; |
|
33
|
|
|
|
|
|
|
} elsif( exists $args{'mmol'} ) { |
|
34
|
3
|
|
|
|
|
6
|
$args{'mgdl'} = $args{'mmol'} * 18.5; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
6
|
|
|
|
|
122
|
return \%args; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Diabetes::Glucose - A simple utility package for storing and manipulating glucose values |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 VERSION |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This document describes version 1.0 |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my $glucose = Diabetes::Glucose->new( |
|
55
|
|
|
|
|
|
|
mgdl => '103', # could also use mmol => 5.9 |
|
56
|
|
|
|
|
|
|
stamp => DateTime->now, |
|
57
|
|
|
|
|
|
|
comment => 'Used a OneTouch meter', |
|
58
|
|
|
|
|
|
|
source => 'Manual Entry' |
|
59
|
|
|
|
|
|
|
); |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
say $glucose->mgdl; # 103 |
|
62
|
|
|
|
|
|
|
say $glucose->mmol; # 5.674931129476585... |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
say $glucose->source; # Manual Entry |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 METHODS |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=over 3 |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item new |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Creates a new object. Nothing much to see here. |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item comment |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
A commment for this particular reading, if anything of note happened. Some systems may make use of it, for whatever |
|
77
|
|
|
|
|
|
|
purposes they want. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item source |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
The source of the reading. This is ued by L<Parse::Dexcom::Tab> and L<Parse::Medtronic::Tab> to note the souce of the |
|
82
|
|
|
|
|
|
|
reading. L<Diabetes::Graph::Glucose> also makes use of this to note the source of data. |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item stamp |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
A timestamp. Should be a DateTime object. Will try hard to convert time-like strings into DateTime objects, but no |
|
87
|
|
|
|
|
|
|
guarantees. Give it what it wants and no one gets hurt. Defaults to C<<DateTime->now>>. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item mgdl, mmol |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Display the currently-stored value in the unit system specified. Using the same data from the L<SYNOPSIS>: |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
say $glucose->mgdl # 103 |
|
94
|
|
|
|
|
|
|
say $glucose->mmol # 5.67... etc, etc. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
The conversion is done at object construction, don't try to change it later, it won't work like you think. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=back |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 BUGS |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
None known, so probably lots. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 AUTHOR |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Dave Houston L<dhouston@cpan.org> |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Dave Houston. This is free software; you can redistribute and/or |
|
111
|
|
|
|
|
|
|
modify it under teh same terms as the Perl 5 programming language. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |