The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Data::Tabulate - Table generation!

VERSION

Version 0.06

SYNOPSIS

Data::Tabulate aims to simplify the generation of tables. Often you don't have tables like in databases (with header and several rows of data), but tables with content only (like image galleries or listings displayed as tables).

You can use other modules (e.g. HTML::Table) to produce specific output.

Perhaps a little code snippet.

    use Data::Tabulate;
    use Data::Dumper;
    
    my @array = qw(1..12);
    
    my $foo   = Data::Tabulate->new();
    my @table = $foo->tabulate(@array);
    
    my $html  = $foo->render('HTMLTable',@array);

METHODS

new

create a new object of Data::Tabulate.

render ( $plugin, {data => \@array [, attr => {%hash}]} )

This methods loads the Plugin $plugin and renders the table with the plugin.

Example:

    my $html_table = $tabulator->render('HTMLTable',{data => [1..10]});

loads the module Data::Tabulate::Plugin::HTMLTable and returns this string:

  <table>
  <tr><td>1</td><td>2</td><td>3</td></tr>
  <tr><td>4</td><td>5</td><td>6</td></tr>
  <tr><td>7</td><td>8</td><td>9</td></tr>
  <tr><td>10</td><td>&nbsp;</td><td>&nbsp;</td></tr>
  </table>

You can write your own plugins.

tabulate( @array )

This methods creates an array of arrays that can be used to render a table or you can do your own thing with the array.

    my @array = $tabulator->tabulate(1..10);

returns

    (
      [ 1,     2,     3 ],
      [ 4,     5,     6 ],
      [ 7,     8,     9 ],
      [10, undef, undef ],
    )

fill_with

if the array doesn't provide enough elements the table is filled with 'undef' elements sometimes this is not the wanted behaviour. So you can change the value that is used to fill the array.

  $obj->fill_with( 'hi' );

for an example see t/04_fill_with.t

cols

returns the number of columns the table has

rows

returns the number of rows the table has

max_columns

set how many columns the table can have (at most).

    $tabulator->max_columns(3);

the table has at most three columns

min_columns

set how many columns the table can have (at least).

    $tabulator->min_columns(3);

the table has at least three columns

do_func($module, $method, @params)

If you need to call some methods of the rendering object, you can use this method, to prepare these method calls.

reset_func( $module )

reset the method call preperations

AUTHOR

Renee Baecker, <module at renee-baecker.de>

BUGS

Please report any bugs or feature requests to bug-data-tabulate at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data-Tabulate. 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::Tabulate

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2006 - 2010 Renee Baecker, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms of Artistic License 2.0.