InterMine
and 1 contributors

NAME

Webservice::InterMine::ResultRow

a class for providing a unified hash and array reference style interface for result rows.

SYNOPSIS

    # Rows should be requested as results for a query.

    use Webservice::InterMine;

    my $query = resultset("Gene")->select("symbol", "proteins.name");

    while (my $row = <$query>) {
        # The following are equivalent:
        print $row->{symbol}, $row->{proteins.name}, "\n";
        print $row->[0], $row->[1];
        print @$row;
    }

DESCRIPTION

This class exists to unify access to row based data regardless of whether you want to use key or column index based lookups for the data. This means you do not have to decide in advance which mechanism you want to use for retrieving data from a webservice.

METHODS

keys

Return the keys for this row, ie. the columns selected for out-put.

to_string

Provides a readable representation of the data in this row.

get_value($key | $index)

If a string is provided, than a hash-style key-lookup will return the value for the matching column, and if an integer is provided, then the appropriate value will be selected via a array based lookup.

to_aref

Return this row as an array-reference. This returns a copy of the data in the row.

to_href($style)

return this row as a hash-reference. This returns a copy of the data in the row.

The three available styles are "full", "short" and "long", depending on whether you want "long" keys ("Gene.proteins.name") or "short" ones ("proteins.name"). "full" gives both, and is the default.

SEE ALSO

AUTHOR

Alex Kalderimis dev@intermine.org

BUGS

Please report any bugs or feature requests to dev@intermine.org.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Webservice::InterMine::ResultObject

You can also look for information at:

COPYRIGHT AND LICENSE

Copyright 2006 - 2011 FlyMine, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.