Иван Бессарабов


Bessarabv::Sleep - get Ivan Bessarabov's sleep data


version 1.0.0


    use Bessarabv::Sleep;

    my $bs = Bessarabv::Sleep->new();

    print $bs->get_sleep_hours("2013-09-27"); # 8.06


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 sleep. Every time I go to sleep I record that time in a text file. And when I get up I also record that time. I have a simple system that parses that text file and sotores that sleep data somewhere in the cloud.

This module is a very simple Perl API to get my sleep time data from 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::Sleep 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 $bs = Bessarabv::Sleep->new();


If there is sleep data for the given date it returns true value. Othervise it returns false value. It should recieve date in the format YYYY-MM-DD. In case the date is incorrect this method will die.

    $bs->has_sleep_data("2013-09-15");  # false
    $bs->has_sleep_data("2013-09-27");  # true


Returns my sleep 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.

    $bs->get_sleep_hours("2013-09-27");  # 8.06
    $bs->get_sleep_hours("2013-09-15");  # Boom! Script dies here because
                        # there is no value. Use has_sleep_data() to check.


Ivan Bessarabov <ivan@bessarabov.ru>


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.