NAME

    Data::Tabulate - Table generation!

VERSION

    version 0.09

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 = (1..12);
    
        my $foo   = Data::Tabulate->new();
        my $html1 = $foo->render('HTMLTable', { data => \@array });
    
        @array = ( 13 .. 24 );
        my @table = $foo->tabulate(@array);
        my $html2 = $foo->render('HTMLTable');
    
        print Dumper({
            'html with raw array data' => $html1,
            'html with tabulate data'  => $html2,
        });

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@renee-baecker.de>

COPYRIGHT AND LICENSE

    This software is Copyright (c) 2015 by Renee Baecker.

    This is free software, licensed under:

      The Artistic License 2.0 (GPL Compatible)