Net::Pachube - Perl extension for accessing pachube.com
version 1.102900
use Net::Pachube; my $pachube = Net::Pachube->new(); my $feed = $pachube->feed($feed_id); print $feed->title, " ", $feed->status, "\n"; foreach my $i (0..$feed->number_of_streams-1) { print "Stream ", $i, " value: ", $feed->data_value($i), "\n"; foreach my $tag ($feed->data_tags($i)) { print " Tag: ", $tag, "\n"; } } # update several streams at once $feed->update(data => [0,1,2,3,4]); # update one stream $feed->update(data => 99);
This module provides a simple API to fetch and/or update pachube.com feeds.
key( [$new_key] )
This method is an accessor/setter for the key attribute which is the Pachube API key to use.
key
url( [$new_url] )
This method is an accessor/setter for the url attribute which is the base URL to use for all HTTP requests.
url
user_agent( [$new_user_agent] )
This method is an accessor/setter for the user_agent attribute which is the LWP user agent object to use for all HTTP requests.
user_agent
new( %parameters )
The constructor creates a new Net:Pachube object. The constructor takes a parameter hash as arguments. Valid parameters in the hash are:
The Pachube API key to use. This parameter is optional. If it is not provided then the value of the environment variable C<PACHUBE_API_KEY> is used.
The base URL to use for all HTTP requests. The default is C<http://www.pachube.com/api>.
The L<LWP> user agent object to use for all HTTP requests. The default is to create a new one for each new L<Net::Pachube> object.
feed( $feed_id )
This method constructs a new Net::Pachube::Feed object and retrieves the feed data from the server.
create( %parameters )
This method makes a POST request to create a new feed. If successful, it returns a Net::Pachube::Feed object for the new feed otherwise it returns undef. The following keys are significant in the hash passed to this method:
POST
The title of the new feed. This is the only mandatory attribute.
A description of the new feed.
The URL of an icon to associate with the new feed.
The URL of a website to associate with the new feed.
An email to associate with the new feed. B<This email address will be publicly available on the L<www.pachube.com> site, so please don't use any email address you wish to keep private.>
The 'exposure' of the new feed - either 'outdoor' or 'indoor'.
The 'disposition' of the new feed - either 'fixed' or 'mobile'.
The 'domain' of the new feed - either 'physical' or 'virtual'.
The name of the location of the new feed.
The latitude of the new feed.
The longitude of the new feed.
The elevation of the new feed.
Pachube web site: http://www.pachube.com/
Mark Hindess <soft-pachube@temporalanomaly.com>
This software is copyright (c) 2010 by Mark Hindess.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Net::Pachube, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Pachube
CPAN shell
perl -MCPAN -e shell install Net::Pachube
For more information on module installation, please visit the detailed CPAN module installation guide.