Dorian Taylor
and 1 contributors


Data::Grid::Row - Row implementation for Data::Grid::Table


Version 0.01_01


    # CSV files are themselves only a single table, so the list
    # context assignment here takes the first and only one.
    my ($table) = Data::Grid->parse('foo.csv')->tables;

    while (my $row = $table->next) {
        my @cells = $row->cells;
        # or
        @cells = @$row;

        # or, if column names were supplied somehow:

        my %cells = $row->as_hash;
        # or
        %cells = %$row;



Retrieve the Data::Grid::Table object to which this row belongs. Alias for "parent" in Data::Grid::Container.


Retrieve the cells from the row, as an array in list context or arrayref in scalar context. The array dereferencing operator @{} is also overloaded and works like this:

    my @cells = @$row;


If the table has a heading or its columns were designated in the constructor or with "columns" in Data::Grid::Table, this method will return the row as key-value pairs in list context and a HASH reference in scalar context. If there is no column spec, this method will generate dummy column names starting from 1, like col1, col2, etc. It will also fill in the blanks if the column spec is shorter than the actual row. If the column spec is longer, the overhang will be populated with undefs. As well it is worth noting that duplicate keys will be clobbered with the rightmost value at this time, though that behaviour may change. As with the other pertinent methods, the hash dereference operator %{} is overloaded and will behave as such:

    my %cells = %$row;


Dorian Taylor, <dorian at>


Please report any bugs or feature requests to bug-data-grid at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


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

    perldoc Data::Grid::Row

You can also look for information at:


Data::Grid, Data::Grid::Container, Data::Grid::Table, Data::Grid::Cell


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 for more information.