Net::Pachube::Feed - Perl extension for manipulating pachube.com feeds
version 1.102900
# normally instantiated using: 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 encapsulates a www.pachube.com feed.
new( %parameters )
The constructor creates a new Net:Pachube::Feed object. This method is generally only called by the Net::Pachube request methods. The constructor takes a parameter hash as arguments. Valid parameters in the hash are:
The id of the feed.
The L<Net::Pachube> connection object.
get( )
This method refreshes the contents of the feed by sending a GET request to the server. It is automatically called when the feed is created but may be called again to refresh the feed data.
GET
eeml( )
This method returns the EEML of the feed.
title( )
This method returns the title of the feed from the EEML if the request was successful.
description( )
This method returns the description of the feed from the EEML if the request was successful.
feed_id( )
This method returns the id of the feed from the EEML if the request was successful. It should always be equal to $self->id which is used to request the feed data.
$self->id
status( )
This method returns the status of the feed from the EEML if the request was successful.
feed_url( )
This method returns the URL for the feed from the EEML if the request was successful.
creator( )
This method returns the creator value from the EEML if the request was successful.
location( [ $key ] )
This method returns the location information from the EEML if the request was successful. If the optional key parameter is not supplied then a hash reference will be returned. If the optional key parameter is supplied then the value for that key from the hash is returned.
key
number_of_streams( )
This method returns the number of data streams present in the feed.
data_value( [ $index ] )
This method returns the value from the data stream from the EEML if the request was successful. If the optional zero-based index parameter is not provided, it is assumed to be zero.
index
data_min( [ $index ] )
This method returns the minimum value for the data stream from the EEML if the request was successful. It may be undefined. If the optional zero-based index parameter is not provided, it is assumed to be zero.
data_max( [ $index ] )
This method returns the maximum value for the data stream from the EEML if the request was successful. It may be undefined. If the optional zero-based index parameter is not provided, it is assumed to be zero.
data_tags( [ $index ] )
This method returns the tag value for the data stream from the EEML if the request was successful. It may be undefined or a list of tags. If the optional zero-based index parameter is not provided, it is assumed to be zero.
<update( data =
This method performs a PUT request in order to update a feed. It returns true on success or undef otherwise.
PUT
delete( )
This method sends a DELETE request to the server to remove it from the server. It returns true if successful or undef otherwise.
DELETE
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.