NAME

Data::Grid::Table - A table implementation for Data::Grid

VERSION

Version 0.01_01

SYNOPSIS

my $grid = Data::Grid->parse('arbitrary.csv');

# Just take the first one, since a CSV will only have one table.
my ($table) = $grid->tables;

while (my $row = $table->next) {
    # do some stuff
}

# or

while (my $row = <$table>) {
    # ...
}

# or

my @rows = $table->rows;

# or

my @rows = @$table;

METHODS

next

Retrieves the next row in the table or undef when it reaches the end. This method "must be overridden" by a driver subclass. The iteration operator <> is also overloaded for table objects, so you can use it like this:

while (my $row = <$table>) { ...

first

Returns the first row in the table, and is equivalent to calling "rewind" and then "next".

rewind

Sets the table's cursor back to the first row. Returns the previous position, beginning at zero. This method must be overridden by a driver subclass.

rows

Retrieves an array of rows all at once, or if taken in scalar context, an array reference. This method overloads the array dereferencing operator @{}, so you can use it like this:

my @rows = @$table;

columns

width

Gets the width, in columns, of the table.

height

Gets the height, in rows, of the table. Careful, for drivers that only do sequential access, this means iterating over the whole set, so you might as well.

as_string

Serializes the table into a string and returns the result. Currently unimplemented.

as_data_table

Returns a new Data::Table object for compatibility.

AUTHOR

Dorian Taylor, <dorian at cpan.org>

BUGS

Please report any bugs or feature requests to bug-data-grid at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data-Grid. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

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

perldoc Data::Grid::Table

You can also look for information at:

SEE ALSO

Data::Grid, Data::Grid::Container, Data::Grid::Row, Data::Grid::Cell

LICENSE AND COPYRIGHT

Copyright 2010 Dorian Taylor.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.