File Coverage

blib/lib/Stancer/Role/Country.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod n/a
total 29 29 100.0


line stmt bran cond sub pod time code
1             package Stancer::Role::Country;
2              
3 25     25   201198 use 5.020;
  25         109  
4 25     25   148 use strict;
  25         52  
  25         770  
5 25     25   370 use warnings;
  25         63  
  25         2341  
6              
7             # ABSTRACT: Country role
8             our $VERSION = '1.0.3'; # VERSION
9              
10 25     25   759 use Stancer::Core::Types qw(Maybe Str Varchar);
  25         63  
  25         2270  
11              
12 25     25   181 use Moo::Role;
  25         83  
  25         226  
13              
14             requires qw(_add_modified _attribute_builder);
15              
16 25     25   17664 use namespace::clean;
  25         305  
  25         218  
17              
18              
19             has city => (
20             is => 'rwp',
21             isa => Maybe[Str],
22 1     1   120 builder => sub { $_[0]->_attribute_builder('country') },
23             lazy => 1,
24             predicate => 1,
25             );
26              
27              
28             has country => (
29             is => 'rwp',
30             isa => Maybe[Str],
31 40     40   1094 builder => sub { $_[0]->_attribute_builder('country') },
32             lazy => 1,
33             predicate => 1,
34             );
35              
36              
37             has zip_code => (
38             is => 'rw',
39             isa => Maybe[Varchar[2, 8]],
40 1     1   53 builder => sub { $_[0]->_attribute_builder('zip_code') },
41             lazy => 1,
42             predicate => 1,
43             trigger => sub { $_[0]->_add_modified('zip_code') },
44             );
45              
46             1;
47              
48             __END__
49              
50             =pod
51              
52             =encoding UTF-8
53              
54             =head1 NAME
55              
56             Stancer::Role::Country - Country role
57              
58             =head1 VERSION
59              
60             version 1.0.3
61              
62             =head1 ATTRIBUTES
63              
64             =head2 C<city>
65              
66             Read/Write string.
67              
68             Customer's city.
69              
70             =head2 C<country>
71              
72             Read-only string.
73              
74             Element country.
75              
76             =head2 C<zip_code>
77              
78             Read-only string.
79              
80             Element zip_code.
81              
82             =head1 USAGE
83              
84             =head2 Logging
85              
86              
87              
88             We use the L<Log::Any> framework for logging events.
89             You may tell where it should log using any available L<Log::Any::Adapter> module.
90              
91             For example, to log everything to a file you just have to add a line to your script, like this:
92             #! /usr/bin/env perl
93             use Log::Any::Adapter (File => '/var/log/payment.log');
94             use Stancer::Role::Country;
95              
96             You must import C<Log::Any::Adapter> before our libraries, to initialize the logger instance before use.
97              
98             You can choose your log level on import directly:
99             use Log::Any::Adapter (File => '/var/log/payment.log', log_level => 'info');
100              
101             Read the L<Log::Any> documentation to know what other options you have.
102              
103             =cut
104              
105             =head1 SECURITY
106              
107             =over
108              
109             =item *
110              
111             Never, never, NEVER register a card or a bank account number in your database.
112              
113             =item *
114              
115             Always uses HTTPS in card/SEPA in communication.
116              
117             =item *
118              
119             Our API will never give you a complete card/SEPA number, only the last four digits.
120             If you need to keep track, use these last four digit.
121              
122             =back
123              
124             =cut
125              
126             =head1 BUGS
127              
128             Please report any bugs or feature requests on the bugtracker website
129             L<https://gitlab.com/wearestancer/library/lib-perl/-/issues> or by email to
130             L<bug-stancer@rt.cpan.org|mailto:bug-stancer@rt.cpan.org>.
131              
132             When submitting a bug or request, please include a test-file or a
133             patch to an existing test-file that illustrates the bug or desired
134             feature.
135              
136             =head1 AUTHOR
137              
138             Joel Da Silva <jdasilva@cpan.org>
139              
140             =head1 COPYRIGHT AND LICENSE
141              
142             This software is Copyright (c) 2018-2024 by Stancer / Iliad78.
143              
144             This is free software, licensed under:
145              
146             The Artistic License 2.0 (GPL Compatible)
147              
148             =cut