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   916016 use base qw(Exporter);
  44         154  
  44         4005  
4 44     44   319 use strict;
  44         113  
  44         882  
5 44     44   255 use warnings;
  44         113  
  44         1702  
6              
7 44     44   1198 use Error::Pure qw(err);
  44         22578  
  44         1819  
8 44     44   400 use Readonly;
  44         109  
  44         6961  
9              
10             Readonly::Array our @EXPORT_OK => qw(print);
11              
12             our $VERSION = 0.12;
13              
14             sub print {
15 3     3 1 1692 my ($obj, $opts_hr) = @_;
16              
17 3 100       23 if (! $obj->isa('Wikibase::Datatype::Value::Sense')) {
18 1         6 err "Object isn't 'Wikibase::Datatype::Value::Sense'.";
19             }
20              
21 2         15 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              
44             =head1 SUBROUTINES
45              
46             =head2 C<print>
47              
48             my $pretty_print_string = print($obj, $opts_hr);
49              
50             Construct pretty print output for L<Wikibase::Datatype::Value::Sense>
51             object.
52              
53             Returns string.
54              
55             =head1 ERRORS
56              
57             print():
58             Object isn't 'Wikibase::Datatype::Value::Sense'.
59             Option 'cb' must be a instance of Wikibase::Cache.
60              
61             =head1 EXAMPLE
62              
63             =for comment filename=create_and_print_value_sense.pl
64              
65             use strict;
66             use warnings;
67              
68             use Wikibase::Datatype::Print::Value::Sense;
69             use Wikibase::Datatype::Value::Sense;
70              
71             # Object.
72             my $obj = Wikibase::Datatype::Value::Sense->new(
73             'value' => 'L34727-S1',
74             );
75              
76             # Print.
77             print Wikibase::Datatype::Print::Value::Sense::print($obj)."\n";
78              
79             # Output:
80             # L34727-S1
81              
82             =head1 DEPENDENCIES
83              
84             L<Error::Pure>,
85             L<Exporter>,
86             L<Readonly>.
87              
88             =head1 SEE ALSO
89              
90             =over
91              
92             =item L<Wikibase::Datatype::Value::Sense>
93              
94             Wikibase sense value datatype.
95              
96             =back
97              
98             =head1 REPOSITORY
99              
100             L<https://github.com/michal-josef-spacek/Wikibase-Datatype-Print>
101              
102             =head1 AUTHOR
103              
104             Michal Josef Špaček L<mailto:skim@cpan.org>
105              
106             L<http://skim.cz>
107              
108             =head1 LICENSE AND COPYRIGHT
109              
110             © 2020-2023 Michal Josef Špaček
111              
112             BSD 2-Clause License
113              
114             =head1 VERSION
115              
116             0.12
117              
118             =cut