| 1 | package Bio::Phylo::Unparsers::Html; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use base 'Bio::Phylo::Unparsers::Abstract'; | ||
| 5 | use Bio::Phylo::Util::CONSTANT qw'/looks_like/ :objecttypes'; | ||
| 6 | use Bio::Phylo::Util::Exceptions 'throw'; | ||
| 7 | use Bio::Phylo::Util::Dependency qw'Template'; | ||
| 8 | |||
| 9 | =head1 NAME | ||
| 10 | |||
| 11 | Bio::Phylo::Unparsers::Html - Serializer used by Bio::Phylo::IO, no serviceable | ||
| 12 | parts inside | ||
| 13 | |||
| 14 | =head1 DESCRIPTION | ||
| 15 | |||
| 16 | This module creates an HTML representation of the provided project | ||
| 17 | |||
| 18 | =begin comment | ||
| 19 | |||
| 20 | Type : Wrapper | ||
| 21 | Title : _to_string | ||
| 22 | Usage : my $json_string = $obj->_to_string; | ||
| 23 | Function: Stringifies a Bio::Phylo object into an HTML string | ||
| 24 | Alias : | ||
| 25 | Returns : SCALAR | ||
| 26 | Args : Bio::Phylo::* object | ||
| 27 | |||
| 28 | =end comment | ||
| 29 | |||
| 30 | =cut | ||
| 31 | |||
| 32 | sub _to_string { | ||
| 33 | my $self = shift; | ||
| 34 | my $obj = $self->{'PHYLO'}; | ||
| 35 | if ( $obj->_type == _PROJECT_ ) { | ||
| 36 | my $result; | ||
| 37 | my $template = $self->{'TEMPLATE'} || \*DATA; | ||
| 38 | my $tt = Template->new; | ||
| 39 | $tt->process($template,{'proj' => $obj},\$result); | ||
| 40 | return $result; | ||
| 41 | } | ||
| 42 | else { | ||
| 43 | throw 'ObjectMismatch' => "Can't make HTML string out of $obj"; | ||
| 44 | } | ||
| 45 | } | ||
| 46 | |||
| 47 | # podinherit_insert_token | ||
| 48 | |||
| 49 | =head1 SEE ALSO | ||
| 50 | |||
| 51 | There is a mailing list at L<https://groups.google.com/forum/#!forum/bio-phylo> | ||
| 52 | for any user or developer questions and discussions. | ||
| 53 | |||
| 54 | =over | ||
| 55 | |||
| 56 | =item L<Bio::Phylo::IO> | ||
| 57 | |||
| 58 | The html unparser is called by the L<Bio::Phylo::IO> object. | ||
| 59 | Look there to learn how to unparse objects. | ||
| 60 | |||
| 61 | =item L<Bio::Phylo::Manual> | ||
| 62 | |||
| 63 | Also see the manual: L<Bio::Phylo::Manual> and L<http://rutgervos.blogspot.com>. | ||
| 64 | |||
| 65 | =back | ||
| 66 | |||
| 67 | =head1 CITATION | ||
| 68 | |||
| 69 | If you use Bio::Phylo in published research, please cite it: | ||
| 70 | |||
| 71 | B<Rutger A Vos>, B<Jason Caravas>, B<Klaas Hartmann>, B<Mark A Jensen> | ||
| 72 | and B<Chase Miller>, 2011. Bio::Phylo - phyloinformatic analysis using Perl. | ||
| 73 | I<BMC Bioinformatics> B<12>:63. | ||
| 74 | L<http://dx.doi.org/10.1186/1471-2105-12-63> | ||
| 75 | |||
| 76 | =cut | ||
| 77 | |||
| 78 | 1; | ||
| 79 | |||
| 80 | __DATA__ |