NAME
POE::Component::Client::opentick::Record - Encapsulation for data records for the POE opentick.com component.
SYNOPSIS
use POE::Component::Client::opentick::Record;
DESCRIPTION
This module contains methods for manipulating resulting records returned by opentick.com's API calls.
Don't fiddle with it. Ist easy schnappen der Springenwerk, blowen-fusen und poppen corken mit spitzensparken.
METHODS
Provides the following public methods for accessing resulting data:
- $object = new( $const_name )
-
Create a new ::Record object.
- initialize( @args )
-
Initialize the object instance.
- set_data( $data )
-
Set the data field of the ::Record object.
- set_datatype( $datatype )
-
Set the datatype field of the ::Record object.
- set_command_id( $command_id )
-
Set the command_id field of the ::Record object.
- [ @values = ] get_data( [ $data ] )
-
Get the actual data from the ::Record object.
This function has 3 forms:
When called with NO ARGUMENTS, it returns an @array (well, a list) of all of the data.
When called with an ARRAYREF argument pointing to an actual variable, it stores the data INTO the passed \@arrayref.
When called with a HASHREF argument pointing to an actual variable, it stores the data INTO the passed \%hashref, with keys being set to the field names, and values set to the corresponding data.
Example:
my( %data, @data ); my @results = $record->get_data(); # Results in @record. my $count = $record->get_data( \%data ); # Results in %data my $count = $record->get_data( \@data ); # Results in @data
- $data = get_raw_data( )
-
Get the raw data as an $arrayref from the ::Record object.
- $data = get_data_as_hashref( )
-
Get the raw data as a mapped $hashref from the ::Record object. Keys are column names, values are the corresponding data.
Just an explicit form of get_data().
- $data = get_data_as_arrayref( )
-
Get the raw data as an $arrayref from the ::Record object.
Just an explicit form of get_data().
- $string = as_string( [ $delimiter] )
-
Get the data from the object as a $string, with fields optionally separated by the value of $delimiter. $delimiter defaults to ' ' (a space).
- @fields = get_field_names( )
-
Get the corresponding field names for the data stored in the ::Record object.
- $cmd_id = get_command_id( )
-
Get the numeric CommandID from the ::Record object. Corresponds with the opentick.com's protocol value for CommandID.
- $cmd_name = get_command_name( )
-
Get the symbolic command name from the ::Record object. Returns a meaningful constant value, suitable for use with some methods in ::Constants.
- $req_id = get_request_id( )
-
Get the numeric $request_id for the request that the data in the ::Record object arrived in response to.
- $datatype = get_datatype( )
-
Get the numeric $datatype corresponding with the resulting records. Probably useless for end users.
- b<$boolean = is_eod( )>
-
Does this ::Record object represent an EndOfData condition? If so, the DATA field is useless. Just wraps $command_id and $request_id.
64-BIT SIMULATION
A couple of responses in the opentick protocol specify 64-bit "long long" return types. This module knows which responses and fields these are, and will "expand" them using Perl hackery to return their proper values, even when Perl isn't compiled with 'use64bitint'.
Currently, this isn't bypassed to use native long longs with a 64-bit perl build, but it will be in a later version.
SEE ALSO
POE -- Information on the Perl Object Environment
POE::Component::Client::opentick -- General documentation on this module
POE::Component::Client::opentick::Constants -- Contains several helper methods to expand some data fields you may receive.
http://poe.perl.org -- Official POE site
http://www.opentick.com/ -- opentick website
AUTHOR
Jason McManus (infi)
LICENSE
Copyright (c) Jason McManus
This module may be used, modified, and distributed under the same terms as Perl itself. Please see the license that came with your Perl distribution for details.
The data from opentick.com are under an entirely separate license that varies according to exchange rules, etc. It is your responsibility to follow the opentick.com and exchange license agreements with the data.
Further details are available on http://www.opentick.com/.