Bessarabv::Weight - get Ivan Bessarabov's weight data
use Bessarabv::Weight; my $bw = Bessarabv::Weight->new(); print $bw->get_weight("2013-08-21") # 82.2
My name is Ivan Bessarabov and I'm a lifelogger. Well, actually I don't record all of my life, but I do records of some parts of my life.
One of the thing that I measure is my weight. I use super pretty iPhone App Weightbot. I've created Perl module Weightbot::API to get data from that App. I use that module to download my weight data and to draw graph.
This module is a very simple Perl API to get info about my weight that is stored somewhere in the cloud. I sometimes play with this numbers, so I have releases this module to make things easy. Not sure if someone else will need this module, but there is no secret here and that's why I've released it on CPAN, but not on my DarkPAN.
Bessarabv::Weight uses Semantic Versioning standart for version numbers. Please visit http://semver.org/ to find out all about this great thing.
This is a constructor. It recieves no parameters and it returns object.
This constructor downloads data from the cloud and stores it in the object. There is only one interaction with the cloud. After the new() is completed no interactions with the cloud is done.
my $bw = Bessarabv::Weight->new();
If there is weight data for the given date it returns true value. Othervise i returns false value. It should recieve date in the format YYYY-MM-DD. In case the date is incorrect this method will die.
$bw->has_weight("2013-08-11"); # false $bw->has_weight("2013-08-20"); # true
Returns my weight in kilograms for the given date. In case the date is incorrect the method dies. The method dies if there is no value for the specified date.
$bw->get_weight("2013-08-10"); # 80.8 $bw->get_weight("2013-08-11"); # Boom! Script dies here because there is # no value. Use has_weight() to check.
Ivan Bessarabov <email@example.com>
This software is copyright (c) 2013 by Ivan Bessarabov.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.