HTMLUtils - a module for useful HTML utilities for Genex DBs
use HTMLUtils;
%new_hash = post_process(%args);
$html_string = objs2table(HEADER=>1, CGI=>$cgi, OBJECTS=>\@obj_list);
Methods for transforming information from a GeneX DB into HTML.
post_process($cgi,%args)
Currently, post_process()
handles the following tasks:
For example, after generating a Genex object, we can create a hyperlinked HTML table output for that object by doing the following:
# we need a CGI object my $q = new CGI;
my $object = Bio::Genex::Species->new(id=>25); foreach (@{Bio::Genex::Species->column_names()}) { no strict 'refs'; $tmp_values{$_} = $object->$_; }
# call post_process() to HTML'ize the values %tmp_values = post_process($q,%tmp_values);
# make a header that's human readable my @rows; my @keys = keys %{Bio::Genex::Species->column2name()}; my @values = values %{Bio::Genex::Species->column2name()}; push(@rows,td([@values]));
# add the data in the same order of the header push(@rows,td([@tmp_values{@keys}]));
# now contstruct the table, print $q->html_start("Information for Species: $object->primary_scientific_name"); print $q->table({-border=>''}, Tr(\@rows) # Tr() distributes over an array reference ); print $q->html_end();
post_process()
.
The 'HEADER' parameter pair is optional and specifies that a human readable header row should be included as the first row of the table output.
NOTE: The returned string must still be wrapped by a $cgi->table()
function call. This is so that the application can pass optional
parameters to the table call.
CAUTION: it is assumed that all the objects in @obj_list are of the same class.
Jason Stewart (jes@ncgr.org)
perl(1).