-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
150 lines (106 loc) · 3.19 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
NAME
Mo::utils::Time - Mo time utilities.
SYNOPSIS
use Mo::utils::Time qw(check_time_24hhmm check_time_24hhmmss);
check_time_24hhmm($self, $key);
check_time_24hhmmss($self, $key);
DESCRIPTION
Mo time utilities for checking of data objects.
SUBROUTINES
"check_time_24hhmm"
check_time_24hhmm($self, $key);
Check parameter defined by $key if it's time in HH:MM format. Value
could be undefined or doesn't exist.
Returns undef.
"check_time_24hhmmss"
check_time_24hhmmss($self, $key);
Check parameter defined by $key if it's time in HH:MM:SS format. Value
could be undefined or doesn't exist.
Returns undef.
ERRORS
check_time_24hhmm():
Parameter '%s' doesn't contain valid hour in HH:MM time format.
Value: %s
Parameter '%s' doesn't contain valid minute in HH:MM time format.
Value: %s
Parameter '%s' doesn't contain valid time in HH:MM format.
Value: %s
check_time_24hhmmss():
Parameter '%s' doesn't contain valid hour in HH:MM:SS time format.
Value: %s
Parameter '%s' doesn't contain valid minute in HH:MM:SS time format.
Value: %s
Parameter '%s' doesn't contain valid second in HH:MM:SS time format.
Value: %s
Parameter '%s' doesn't contain valid time in HH:MM:SS format.
Value: %s
EXAMPLE1
use strict;
use warnings;
use Mo::utils::Time qw(check_time_24hhmm);
my $self = {
'key' => '12:32',
};
check_time_24hhmm($self, 'key');
# Print out.
print "ok\n";
# Output:
# ok
EXAMPLE2
use strict;
use warnings;
use Error::Pure;
use Mo::utils::Time qw(check_time_24hhmm);
$Error::Pure::TYPE = 'Error';
my $self = {
'key' => 'xx',
};
check_time_24hhmm($self, 'key');
# Print out.
print "ok\n";
# Output like:
# #Error [...utils.pm:?] Parameter 'key' doesn't contain valid time in HH:MM format.
EXAMPLE3
use strict;
use warnings;
use Mo::utils::Time qw(check_time_24hhmmss);
my $self = {
'key' => '12:30:30',
};
check_time_24hhmmss($self, 'key');
# Print out.
print "ok\n";
# Output:
# ok
EXAMPLE4
use strict;
use warnings;
use Error::Pure;
use Mo::utils::Time qw(check_time_24hhmmss);
$Error::Pure::TYPE = 'Error';
my $self = {
'key' => 'bad',
};
check_time_24hhmmss($self, 'key');
# Print out.
print "ok\n";
# Output like:
# #Error [...utils.pm:?] Parameter 'key' doesn't contain valid time in HH:MM:SS format.
DEPENDENCIES
Error::Pure, Exporter, Readonly.
SEE ALSO
Mo Micro Objects. Mo is less.
Mo::utils
Mo utilities.
Wikibase::Datatype::Utils
Wikibase datatype utilities.
REPOSITORY
<https://github.com/michal-josef-spacek/Mo-utils-Time>
AUTHOR
Michal Josef Špaček <mailto:skim@cpan.org>
<http://skim.cz>
LICENSE AND COPYRIGHT
© 2024 Michal Josef Špaček
BSD 2-Clause License
VERSION
0.02