Weightbot::API - get Weightbot iPhone app data from


version 1.1.0


There is a great iPhone weight tracking app It backups its data to the site where everyone using that app can login and download the file with the records.

This module gets that data and shows it as a pretty data structure.

    use Weightbot::API;
    use Data::Dumper;

    my $wi = Weightbot::API->new({
        email    => '',
        password => '******',

    say $wi->raw_data;
    say Dumper $wi->data;

The object does not send requests to site until data needs to be retrieved. The first invocation of either data() or raw_data() methods will get data from the site and it will be stored in the object, so you can use raw_data() and data() many times without unnecessary requests to the site.

Site does not have real API, this module behaves as a browser.


Weightbot::API version numbers uses Semantic Versioning standart. Please visit to find out all about this great thing.

While debugging your programme that uses this module it is not a great idea to send requests to on every test run. This module can cache data to file. The module will read data from the cache file if the file exists or will download data and save it to the file if there is no cache file.

To use this feature you should create Weightbot::API object with:

    my $wi = Weightbot::API->new({
        email    => '',
        password => '******',
        use_cache_file => 1,
        cache_file     => '/storage/weightbot.raw',     # optional

The default value for 'cache_file' is '/tmp/'.

So when you debug your programme you can specify 'use_cache_file'. Then on first run the data will be downloaded from and saved to file and all other runs will use data from the file without asking



Creates new object. It has to get parameters 'email' and 'password'. Optionally you can specify 'site' with some custom site url (default is ''). The other optional thing is to specify 'raw_data'.

    my $wi = Weightbot::API->new({
        email    => '',
        password => '******',


Returns the weight records in the format as they are stored on the site. Here is an example:

    date, kilograms, pounds
    2008-12-04, 80.9, 178.4
    2008-12-05, 82.6, 182.1
    2008-12-06, 81.9, 180.6
    2008-12-08, 82.6, 182.1

Any subsequent call to this method will not result in actual data retrieval as the data is cached within the object.


Returns the weight data in a structure. In that data some dates can be skipped. In this structure all the dates are present, but if there is no weight for that date the empty sting is used.

An example for the data show in raw_data() method:

    $VAR1 = [
                'n' => 1,
                'date' => '2008-12-04',
                'kg' => '80.9',
                'lb' => '178.4'
                'n' => 2,
                'date' => '2008-12-05',
                'kg' => '82.6',
                'lb' => '182.1'
                'n' => 3,
                'date' => '2008-12-06',
                'kg' => '81.9',
                'lb' => '180.6'
                'n' => 4,
                'date' => '2008-12-07',
                'kg' => '',
                'lb' => ''
                'n' => 5,
                'date' => '2008-12-08',
                'kg' => '82.6',
                'lb' => '182.1'

Any subsequent call to this method will not result in actual data retrieval as the data is cached within the object.


Evgeniy Kosov <>


Please report any bugs or feature requests to bug-weightbot-api at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. You can also submit a bug or a feature request on GitHub.


The source code for this module is hosted on GitHub


Ivan Bessarabov <>


This software is copyright (c) 2011 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.