File Coverage

blib/lib/Wikibase/Datatype/Print/Value/Sense.pm
Criterion Covered Total %
statement 20 20 100.0
branch 2 2 100.0
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 29 29 100.0


line stmt bran cond sub pod time code
1             package Wikibase::Datatype::Print::Value::Sense;
2              
3 44     44   907050 use base qw(Exporter);
  44         164  
  44         4193  
4 44     44   323 use strict;
  44         109  
  44         919  
5 44     44   287 use warnings;
  44         112  
  44         1645  
6              
7 44     44   1241 use Error::Pure qw(err);
  44         22949  
  44         1744  
8 44     44   395 use Readonly;
  44         119  
  44         6879  
9              
10             Readonly::Array our @EXPORT_OK => qw(print);
11              
12             our $VERSION = 0.13;
13              
14             sub print {
15 3     3 1 1721 my ($obj, $opts_hr) = @_;
16              
17 3 100       22 if (! $obj->isa('Wikibase::Datatype::Value::Sense')) {
18 1         15 err "Object isn't 'Wikibase::Datatype::Value::Sense'.";
19             }
20              
21 2         17 my $sense = $obj->value;
22              
23 2         22 return $sense;
24             }
25              
26             1;
27              
28             __END__
29              
30             =pod
31              
32             =encoding utf8
33              
34             =head1 NAME
35              
36             Wikibase::Datatype::Print::Value::Sense - Wikibase sense value pretty print helpers.
37              
38             =head1 SYNOPSIS
39              
40             use Wikibase::Datatype::Print::Value::Sense qw(print);
41              
42             my $pretty_print_string = print($obj, $opts_hr);
43             my @pretty_print_lines = print($obj, $opts_hr);
44              
45             =head1 SUBROUTINES
46              
47             =head2 C<print>
48              
49             my $pretty_print_string = print($obj, $opts_hr);
50             my @pretty_print_lines = print($obj, $opts_hr);
51              
52             Construct pretty print output for L<Wikibase::Datatype::Value::Sense>
53             object.
54              
55             Returns string in scalar context.
56             Returns list of lines in array context.
57              
58             =head1 ERRORS
59              
60             print():
61             Object isn't 'Wikibase::Datatype::Value::Sense'.
62             Option 'cb' must be a instance of Wikibase::Cache.
63              
64             =head1 EXAMPLE
65              
66             =for comment filename=create_and_print_value_sense.pl
67              
68             use strict;
69             use warnings;
70              
71             use Wikibase::Datatype::Print::Value::Sense;
72             use Wikibase::Datatype::Value::Sense;
73              
74             # Object.
75             my $obj = Wikibase::Datatype::Value::Sense->new(
76             'value' => 'L34727-S1',
77             );
78              
79             # Print.
80             print Wikibase::Datatype::Print::Value::Sense::print($obj)."\n";
81              
82             # Output:
83             # L34727-S1
84              
85             =head1 DEPENDENCIES
86              
87             L<Error::Pure>,
88             L<Exporter>,
89             L<Readonly>.
90              
91             =head1 SEE ALSO
92              
93             =over
94              
95             =item L<Wikibase::Datatype::Value::Sense>
96              
97             Wikibase sense value datatype.
98              
99             =back
100              
101             =head1 REPOSITORY
102              
103             L<https://github.com/michal-josef-spacek/Wikibase-Datatype-Print>
104              
105             =head1 AUTHOR
106              
107             Michal Josef Špaček L<mailto:skim@cpan.org>
108              
109             L<http://skim.cz>
110              
111             =head1 LICENSE AND COPYRIGHT
112              
113             © 2020-2023 Michal Josef Špaček
114              
115             BSD 2-Clause License
116              
117             =head1 VERSION
118              
119             0.13
120              
121             =cut