File Coverage

blib/lib/Wikibase/Datatype/Print/Property.pm
Criterion Covered Total %
statement 37 37 100.0
branch 5 8 62.5
condition n/a
subroutine 9 9 100.0
pod 0 1 0.0
total 51 55 92.7


line stmt bran cond sub pod time code
1             package Wikibase::Datatype::Print::Property;
2              
3 3     3   908968 use base qw(Exporter);
  3         34  
  3         335  
4 3     3   24 use strict;
  3         6  
  3         57  
5 3     3   14 use warnings;
  3         7  
  3         118  
6              
7 3     3   938 use Error::Pure qw(err);
  3         22167  
  3         73  
8 3     3   117 use Readonly;
  3         7  
  3         122  
9 3     3   1556 use Wikibase::Datatype::Print::Statement;
  3         11  
  3         147  
10 3         136 use Wikibase::Datatype::Print::Utils qw(print_aliases print_descriptions
11 3     3   21 print_labels print_statements);
  3         7  
12 3     3   21 use Wikibase::Datatype::Print::Value::Monolingual;
  3         6  
  3         715  
13              
14             Readonly::Array our @EXPORT_OK => qw(print);
15              
16             our $VERSION = 0.09;
17              
18             sub print {
19 2     2 0 8183 my ($obj, $opts_hr) = @_;
20              
21 2 50       8 if (! defined $opts_hr) {
22 2         4 $opts_hr = {};
23             }
24              
25 2 50       7 if (! exists $opts_hr->{'lang'}) {
26 2         6 $opts_hr->{'lang'} = 'en';
27             }
28              
29 2 100       15 if (! $obj->isa('Wikibase::Datatype::Property')) {
30 1         6 err "Object isn't 'Wikibase::Datatype::Property'.";
31             }
32              
33 1         6 my @ret = (
34             'Data type: '.$obj->datatype,
35             );
36              
37             # Label.
38 1         12 push @ret, print_labels($obj, $opts_hr,
39             \&Wikibase::Datatype::Print::Value::Monolingual::print);
40              
41             # Description.
42 1         9 push @ret, print_descriptions($obj, $opts_hr,
43             \&Wikibase::Datatype::Print::Value::Monolingual::print);
44              
45             # Aliases.
46 1         9 push @ret, print_aliases($obj, $opts_hr,
47             \&Wikibase::Datatype::Print::Value::Monolingual::print);
48              
49             # Statements.
50 1         6 push @ret, print_statements($obj, $opts_hr,
51             \&Wikibase::Datatype::Print::Statement::print);
52              
53 1 50       22 return wantarray ? @ret : (join "\n", @ret);
54             }
55              
56             1;
57              
58             __END__