HTML::HashTable - Create an HTML table from a Perl hash
HTML::HashTable
use HTML::HashTable; print tablify({ BORDER => 0, DATA => $myhashref, SORTBY => 'key', ORDER => 'desc'} );
This module takes an arbitrary Perl hash and presents it as an HTML table. The hash can contain anything you want -- scalar data, arrayrefs, hashrefs, whatever. Yes, this means you can use a tied hash if you wish.
The HTML produced is nicely formatted and indented, suitable for human editing and manipulation.
Some options are provided with the tablify() function to allow you to specify whether you wish to have a border or not, and whether you wish your table to be sorted by key or value (but note that sorting by value gives almost meaningless results if your values are references, as in a deeply nested Perl data structure.)
The options given to the tablify() function are:
BORDER
True or false depending on whether you want your table to have a border. Defaults to true (1).
DATA
Reference to your hash
SORTBY
Either 'key' or 'value' depending on how you want your data sorted. Note that sorting by value is more or less meaningless if your values are references (as in a deeply nested data structure). Defaults to "key".
ORDER
Either 'asc' or 'desc' depending on whether you want your sorting to be in ascending or descending order. Defaults to "asc".
Kirrily "Skud" Robert <skud@cpan.org>
perl.
2 POD Errors
The following errors were encountered while parsing the POD:
'=item' outside of any '=over'
You forgot a '=back' before '=head1'
To install HTML::HashTable, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::HashTable
CPAN shell
perl -MCPAN -e shell install HTML::HashTable
For more information on module installation, please visit the detailed CPAN module installation guide.