Phylo/Unparsers/Json.pm untested

filter: Statementstmt 0.0% 0 / 20 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 29 CC 2 SCAR 11.5
CC
2
Cov
0%
_to_string
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.1
1 package Bio::Phylo::Unparsers::Json;
2 use strict;
3 use base 'Bio::Phylo::Unparsers::Abstract';
4 use Bio::Phylo::Util::CONSTANT qw'/looks_like/';
5 use Bio::Phylo::Util::Exceptions 'throw';
6 use Bio::Phylo::Util::Dependency qw'XML::XML2JSON';
7  
8 =head1 NAME
9  
10 Bio::Phylo::Unparsers::Json - Serializer used by Bio::Phylo::IO, no serviceable
11 parts inside
12  
13 =head1 DESCRIPTION
14  
15 This module turns the supplied object into a JSON string.
16  
17 =begin comment
18  
19 Type : Wrapper
20 Title : _to_string
21 Usage : my $json_string = $obj->_to_string;
22 Function: Stringifies a Bio::Phylo object into a JSON string
23 Alias :
24 Returns : SCALAR
25 Args : Bio::Phylo::* object
26  
27 =end comment
28  
29 =cut
30  
31 sub _to_string {
32 my $self = shift;
33 my $obj = $self->{'PHYLO'};
34 if ( looks_like_implementor $obj, 'to_json' ) {
35 return $obj->to_json;
36 }
37 else {
38 throw 'ObjectMismatch' => "Can't make JSON string out of $obj";
39 }
40 }
41  
42 # podinherit_insert_token
43  
44 =head1 SEE ALSO
45  
46 There is a mailing list at L<https://groups.google.com/forum/#!forum/bio-phylo>
47 for any user or developer questions and discussions.
48  
49 =over
50  
51 =item L<Bio::Phylo::IO>
52  
53 The json unparser is called by the L<Bio::Phylo::IO> object.
54 Look there to learn how to unparse objects.
55  
56 =item L<Bio::Phylo::Manual>
57  
58 Also see the manual: L<Bio::Phylo::Manual> and L<http://rutgervos.blogspot.com>.
59  
60 =item L<http://www.json.org>
61  
62 To learn more about the JavaScript Object Notation (JSON) format, visit
63 L<http://www.json.org>.
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;