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   933601 use base qw(Exporter);
  3         35  
  3         293  
4 3     3   28 use strict;
  3         6  
  3         59  
5 3     3   16 use warnings;
  3         7  
  3         75  
6              
7 3     3   934 use Error::Pure qw(err);
  3         23066  
  3         86  
8 3     3   117 use Readonly;
  3         6  
  3         110  
9 3     3   1475 use Wikibase::Datatype::Print::Statement;
  3         10  
  3         174  
10 3         149 use Wikibase::Datatype::Print::Utils qw(print_aliases print_descriptions
11 3     3   20 print_labels print_statements);
  3         9  
12 3     3   20 use Wikibase::Datatype::Print::Value::Monolingual;
  3         6  
  3         797  
13              
14             Readonly::Array our @EXPORT_OK => qw(print);
15              
16             our $VERSION = 0.12;
17              
18             sub print {
19 2     2 0 11065 my ($obj, $opts_hr) = @_;
20              
21 2 50       9 if (! defined $opts_hr) {
22 2         5 $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       13 if (! $obj->isa('Wikibase::Datatype::Property')) {
30 1         5 err "Object isn't 'Wikibase::Datatype::Property'.";
31             }
32              
33 1         45 my @ret = (
34             'Data type: '.$obj->datatype,
35             );
36              
37             # Label.
38 1         17 push @ret, print_labels($obj, $opts_hr,
39             \&Wikibase::Datatype::Print::Value::Monolingual::print);
40              
41             # Description.
42 1         7 push @ret, print_descriptions($obj, $opts_hr,
43             \&Wikibase::Datatype::Print::Value::Monolingual::print);
44              
45             # Aliases.
46 1         7 push @ret, print_aliases($obj, $opts_hr,
47             \&Wikibase::Datatype::Print::Value::Monolingual::print);
48              
49             # Statements.
50 1         13 push @ret, print_statements($obj, $opts_hr,
51             \&Wikibase::Datatype::Print::Statement::print);
52              
53 1 50       9 return wantarray ? @ret : (join "\n", @ret);
54             }
55              
56             1;
57              
58             __END__