File Coverage

blib/lib/Stancer/Core/Types/Dates.pm
Criterion Covered Total %
statement 29 29 100.0
branch n/a
condition n/a
subroutine 10 10 100.0
pod n/a
total 39 39 100.0


line stmt bran cond sub pod time code
1             package Stancer::Core::Types::Dates;
2              
3 61     61   285342 use 5.020;
  61         250  
4 61     61   372 use strict;
  61         141  
  61         2039  
5 61     61   324 use warnings;
  61         123  
  61         8623  
6              
7             # ABSTRACT: Internal dates types
8             our $VERSION = '1.0.3'; # VERSION
9              
10             our @EXPORT_OK = ();
11             our %EXPORT_TAGS = ('all' => \@EXPORT_OK);
12              
13 61     61   1515 use Stancer::Core::Types::Bases qw();
  61         177  
  61         2025  
14 61     61   428 use Stancer::Core::Types::Helper qw(error_message);
  61         157  
  61         4238  
15 61     61   32335 use Stancer::Exceptions::InvalidExpirationMonth;
  61         305  
  61         2891  
16 61     61   33397 use Stancer::Exceptions::InvalidExpirationYear;
  61         311  
  61         3192  
17 61     61   490 use List::MoreUtils qw(any);
  61         134  
  61         781  
18              
19 61     61   55020 use namespace::clean;
  61         145  
  61         337  
20              
21 61     61   16396 use Exporter qw(import);
  61         139  
  61         12892  
22              
23             my @defs = ();
24              
25             push @defs, {
26             name => 'Month',
27             subtype_of => 'Int',
28             from => 'Stancer::Core::Types::Bases',
29             test => sub { 1 <= $_[0] && $_[0] <= 12 },
30             message => error_message('Must be an integer between 1 and 12 (included), %s given.'),
31             exception => 'Stancer::Exceptions::InvalidExpirationMonth',
32             };
33              
34             push @defs, {
35             name => 'Year',
36             subtype_of => 'Int',
37             from => 'Stancer::Core::Types::Bases',
38             test => sub { 1 },
39             message => error_message('Must be an integer, %s given.'),
40             exception => 'Stancer::Exceptions::InvalidExpirationYear',
41             };
42              
43             Stancer::Core::Types::Helper::register_types(\@defs, __PACKAGE__);
44              
45             1;
46              
47             __END__
48              
49             =pod
50              
51             =encoding UTF-8
52              
53             =head1 NAME
54              
55             Stancer::Core::Types::Dates - Internal dates types
56              
57             =head1 VERSION
58              
59             version 1.0.3
60              
61             =head1 USAGE
62              
63             =head2 Logging
64              
65              
66              
67             We use the L<Log::Any> framework for logging events.
68             You may tell where it should log using any available L<Log::Any::Adapter> module.
69              
70             For example, to log everything to a file you just have to add a line to your script, like this:
71             #! /usr/bin/env perl
72             use Log::Any::Adapter (File => '/var/log/payment.log');
73             use Stancer::Core::Types::Dates;
74              
75             You must import C<Log::Any::Adapter> before our libraries, to initialize the logger instance before use.
76              
77             You can choose your log level on import directly:
78             use Log::Any::Adapter (File => '/var/log/payment.log', log_level => 'info');
79              
80             Read the L<Log::Any> documentation to know what other options you have.
81              
82             =cut
83              
84             =head1 SECURITY
85              
86             =over
87              
88             =item *
89              
90             Never, never, NEVER register a card or a bank account number in your database.
91              
92             =item *
93              
94             Always uses HTTPS in card/SEPA in communication.
95              
96             =item *
97              
98             Our API will never give you a complete card/SEPA number, only the last four digits.
99             If you need to keep track, use these last four digit.
100              
101             =back
102              
103             =cut
104              
105             =head1 BUGS
106              
107             Please report any bugs or feature requests on the bugtracker website
108             L<https://gitlab.com/wearestancer/library/lib-perl/-/issues> or by email to
109             L<bug-stancer@rt.cpan.org|mailto:bug-stancer@rt.cpan.org>.
110              
111             When submitting a bug or request, please include a test-file or a
112             patch to an existing test-file that illustrates the bug or desired
113             feature.
114              
115             =head1 AUTHOR
116              
117             Joel Da Silva <jdasilva@cpan.org>
118              
119             =head1 COPYRIGHT AND LICENSE
120              
121             This software is Copyright (c) 2018-2024 by Stancer / Iliad78.
122              
123             This is free software, licensed under:
124              
125             The Artistic License 2.0 (GPL Compatible)
126              
127             =cut