File Coverage

blib/lib/Test/Shared/Fixture/Data/InfoBox/Person.pm
Criterion Covered Total %
statement 25 25 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 1 1 100.0
total 34 34 100.0


line stmt bran cond sub pod time code
1             package Test::Shared::Fixture::Data::InfoBox::Person;
2              
3 4     4   563938 use base qw(Data::InfoBox);
  4         9  
  4         2319  
4 4     4   38 use strict;
  4         6  
  4         122  
5 4     4   24 use warnings;
  4         15  
  4         182  
6              
7 4     4   2173 use Data::Icon;
  4         392728  
  4         190  
8 4     4   2314 use Data::InfoBox::Item;
  4         14  
  4         168  
9 4     4   2003 use Data::Text::Simple;
  4         1152041  
  4         198  
10 4     4   1764 use Unicode::UTF8 qw(decode_utf8);
  4         3641  
  4         1030  
11              
12             our $VERSION = 0.07;
13              
14             sub new {
15 2     2 1 452826 my $class = shift;
16              
17 2         42 my @params = (
18             'items' => [
19             Data::InfoBox::Item->new(
20             'icon' => Data::Icon->new(
21             'char' => decode_utf8('🧍'),
22             ),
23             'text' => Data::Text::Simple->new(
24             'text' => decode_utf8('Michal Josef Špaček'),
25             ),
26             ),
27             Data::InfoBox::Item->new(
28             'icon' => Data::Icon->new(
29             'char' => decode_utf8('☎'),
30             ),
31             'text' => Data::Text::Simple->new(
32             'text' => '+420777623160',
33             ),
34             'uri' => 'tel:+420777623160',
35             ),
36             ],
37             );
38              
39 2         53 my $self = $class->SUPER::new(@params);
40              
41 2         21 return $self;
42             }
43              
44             1;
45              
46             __END__
47              
48             =pod
49              
50             =encoding utf8
51              
52             =head1 NAME
53              
54             Test::Shared::Fixture::Data::InfoBox::Person - Person info box fixture.
55              
56             =head1 SYNOPSIS
57              
58             use Test::Shared::Fixture::Data::InfoBox::Person;
59              
60             my $obj = Test::Shared::Fixture::Data::InfoBox::Person->new;
61             my $items_ar = $obj->items;
62              
63             =head1 METHODS
64              
65             =head2 C<new>
66              
67             my $obj = Test::Shared::Fixture::Data::InfoBox::Person->new;
68              
69             Constructor.
70              
71             Returns instance of object.
72              
73             =head2 C<items>
74              
75             my $items_ar = $obj->items;
76              
77             Get list of items in info box.
78              
79             Returns reference to array with L<Data::InfoBox::Item> objects.
80              
81             =head1 EXAMPLE
82              
83             =for comment filename=create_person_fixture_object_and_print.pl
84              
85             use strict;
86             use warnings;
87              
88             use Test::Shared::Fixture::Data::InfoBox::Person;
89             use Unicode::UTF8 qw(encode_utf8);
90              
91             my $obj = Test::Shared::Fixture::Data::InfoBox::Person->new;
92              
93             # Print out.
94             my $num = 0;
95             foreach my $item (@{$obj->items}) {
96             $num++;
97             print "Item $num: ".encode_utf8($item->text->text)."\n";
98             }
99              
100             # Output:
101             # Item 1: Michal Josef Špaček
102             # Item 2: +420777623160
103              
104             =head1 DEPENDENCIES
105              
106             L<Data::InfoBox>,
107             L<Data::InfoBox::Item>,
108             L<Data::Text::Simple>,
109             L<Unicode::UTF8>.
110              
111             =head1 REPOSITORY
112              
113             L<https://github.com/michal-josef-spacek/Data-InfoBox>
114              
115             =head1 AUTHOR
116              
117             Michal Josef Špaček L<mailto:skim@cpan.org>
118              
119             L<http://skim.cz>
120              
121             =head1 LICENSE AND COPYRIGHT
122              
123             © 2024-2025 Michal Josef Špaček
124              
125             BSD 2-Clause License
126              
127             =head1 VERSION
128              
129             0.07
130              
131             =cut