| Data-Tabulate-Plugin-HTMLTable documentation | Contained in the Data-Tabulate-Plugin-HTMLTable distribution. |
Data::Tabulate::Plugin::HTMLTable - HTML::Table plugin for Data::Tabulate
version 0.03
This module renders the table for HTML
use Data::Tabulate;
my @array = (1..10);
my $foo = Data::Tabulate->new();
my $html = $foo->render('HTMLTable',{data => [@array]});
create a new object of Data::Tabulate::Plugin::HTMLTable.
returns a string that contains the HTML source for the table
set some attributes for HTML::Table.
Renee Baecker <module@renee-baecker.de>
This software is Copyright (c) 2010 by Renee Baecker.
This is free software, licensed under:
The Artistic License 2.0
| Data-Tabulate-Plugin-HTMLTable documentation | Contained in the Data-Tabulate-Plugin-HTMLTable distribution. |
package Data::Tabulate::Plugin::HTMLTable; use warnings; use strict; use HTML::Table; # ABSTRACT: HTML::Table plugin for Data::Tabulate our $VERSION = '0.03'; sub new{ return bless {},shift; } sub output { my ($self,@data) = @_; my %atts = $self->attributes(); my $obj = HTML::Table->new(%atts); for(@data){ my @row = map{defined($_) ? $_ : ' '}@$_; $obj->addRow(@row); } return $obj->getTable(); } sub attributes{ my ($self,%atts) = @_; $self->{attributes} = {%atts} if keys %atts; my %return = (); if(defined $self->{attributes} and ref($self->{attributes}) eq 'HASH'){ %return = %{$self->{attributes}} } return %return; } 1; # End of Data::Tabulate::Plugin::HTMLTable __END__