Mark Hindess > Net-Pachube > Net::Pachube

Download:
Net-Pachube-1.102900.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Module Version: 1.102900   Source  

NAME ^

Net::Pachube - Perl extension for accessing pachube.com

VERSION ^

version 1.102900

SYNOPSIS ^

  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);

DESCRIPTION ^

This module provides a simple API to fetch and/or update pachube.com feeds.

ATTRIBUTES ^

key( [$new_key] )

This method is an accessor/setter for the key attribute which is the Pachube API key to use.

url( [$new_url] )

This method is an accessor/setter for the url attribute which is the base URL to use for all HTTP requests.

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.

METHODS ^

new( %parameters )

The constructor creates a new Net:Pachube object. The constructor takes a parameter hash as arguments. Valid parameters in the hash are:

key
  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.
url
  The base URL to use for all HTTP requests.  The default is
  C<http://www.pachube.com/api>.
user_agent
  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:

title
  The title of the new feed.  This is the only mandatory attribute.
description
  A description of the new feed.
icon
  The URL of an icon to associate with the new feed.
website
  The URL of a website to associate with the new feed.
email
  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.>
exposure
  The 'exposure' of the new feed - either 'outdoor' or 'indoor'.
disposition
  The 'disposition' of the new feed - either 'fixed' or 'mobile'.
domain
  The 'domain' of the new feed - either 'physical' or 'virtual'.
location_name
  The name of the location of the new feed.
lat
  The latitude of the new feed.
lon
  The longitude of the new feed.
ele
  The elevation of the new feed.

SEE ALSO ^

Pachube web site: http://www.pachube.com/

AUTHOR ^

Mark Hindess <soft-pachube@temporalanomaly.com>

COPYRIGHT AND LICENSE ^

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.

syntax highlighting: