File Coverage

blib/lib/Data/Kramerius/Object.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Data::Kramerius::Object;
2              
3 13     13   81532 use strict;
  13         63  
  13         358  
4 13     13   63 use warnings;
  13         36  
  13         368  
5              
6 13     13   5970 use Mo qw(is required);
  13         6750  
  13         76  
7              
8             our $VERSION = 0.06;
9              
10             has active => (
11             is => 'ro',
12             required => 1,
13             );
14              
15             has id => (
16             is => 'ro',
17             required => 1,
18             );
19              
20             has name => (
21             is => 'ro',
22             required => 1,
23             );
24              
25             has url => (
26             is => 'ro',
27             required => 1,
28             );
29              
30             has version => (
31             is => 'ro',
32             required => 1,
33             );
34              
35             1;
36              
37             __END__
38              
39             =pod
40              
41             =encoding utf8
42              
43             =head1 NAME
44              
45             Data::Kramerius::Object - Data object for kramerius instance.
46              
47             =head1 SYNOPSIS
48              
49             use Data::Kramerius::Object;
50              
51             my $obj = Data::Kramerius::Object->new(%params);
52             my $active = $obj->active;
53             my $id = $obj->id;
54             my $name = $obj->name;
55             my $url = $obj->url;
56             my $version = $obj->version;
57              
58             =head1 METHODS
59              
60             =head2 C<new>
61              
62             my $obj = Data::Kramerius::Object->new(%params);
63              
64             Constructor.
65              
66             Returns instance of object.
67              
68             =over 8
69              
70             =item * C<active>
71              
72             Flag which means, if project is or not active.
73             It's required.
74              
75             =item * C<id>
76              
77             Id of Kramerius system.
78             It's required.
79              
80             =item * C<name>
81              
82             Name of Kramerius system.
83             It's required.
84              
85             =item * C<url>
86              
87             URL of Kramerius system.
88             It's required.
89              
90             =item * C<version>
91              
92             Version of Kramerius system.
93             It's required.
94              
95             =back
96              
97             =head2 C<active>
98              
99             my $active = $obj->active;
100              
101             Get flag about activity of Kramerius system.
102              
103             Returns 0/1.
104              
105             =head2 C<id>
106              
107             my $id = $obj->id;
108              
109             Get id of Kramerius system.
110              
111             Returns string.
112              
113             =head2 C<name>
114              
115             my $name = $obj->name;
116              
117             Get name of Kramerius system.
118              
119             Returns string.
120              
121             =head2 C<url>
122              
123             my $url = $obj->url;
124              
125             Get URL of Kramerius system.
126              
127             Returns string.
128              
129             =head2 C<version>
130              
131             my $version = $obj->version;
132              
133             Get version of Kramerius system.
134              
135             Returns number.
136              
137             =head1 EXAMPLE
138              
139             =for comment filename=create_object_and_print.pl
140              
141             use strict;
142             use warnings;
143              
144             use Data::Kramerius::Object;
145              
146             my $obj = Data::Kramerius::Object->new(
147             'active' => 1,
148             'id' => 'foo',
149             'name' => 'Foo Kramerius',
150             'url' => 'https://foo.example.com',
151             'version' => 4,
152             );
153              
154             # Print out.
155             print 'Active: '.$obj->active."\n";
156             print 'Id: '.$obj->id."\n";
157             print 'Name: '.$obj->name."\n";
158             print 'URL: '.$obj->url."\n";
159             print 'Version: '.$obj->version."\n";
160              
161             # Output:
162             # Active: 1
163             # Id: foo
164             # Name: Foo Kramerius
165             # URL: https://foo.example.com
166             # Version: 4
167              
168             =head1 DEPENDENCIES
169              
170             L<Mo>.
171              
172             =head1 REPOSITORY
173              
174             L<https://github.com/michal-josef-spacek/Data-Kramerius>
175              
176             =head1 AUTHOR
177              
178             Michal Josef Špaček L<mailto:skim@cpan.org>
179              
180             L<http://skim.cz>
181              
182             =head1 LICENSE AND COPYRIGHT
183              
184             © 2021-2023 Michal Josef Špaček
185              
186             BSD 2-Clause License
187              
188             =head1 VERSION
189              
190             0.06
191              
192             =cut