line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
751
|
use 5.20.0; |
|
2
|
|
|
|
|
6
|
|
2
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
31
|
|
3
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
113
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package DBIx::Class::Smooth::Lookup::DateTime::datepart; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: Short intro |
8
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY |
9
|
|
|
|
|
|
|
our $VERSION = '0.0102'; |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
12
|
use parent 'DBIx::Class::Smooth::Lookup::Util'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
10
|
|
12
|
2
|
|
|
2
|
|
126
|
use Carp qw/carp confess/; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
124
|
|
13
|
2
|
|
|
2
|
|
18
|
use experimental qw/signatures postderef/; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
9
|
|
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
0
|
0
|
|
sub smooth__lookup__datepart($self, $column_name, $value, $params, @rest) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
$self->smooth__lookup_util__ensure_param_count('substring', $params, { at_least => 1, at_most => 1, regex => qr/^[a-z_]+$/i }); |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $datepart = $params->[0]; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
0
|
|
|
local $SIG{'__WARN__'} = sub ($message) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
21
|
0
|
0
|
|
|
|
|
if($message =~ m{uninitialized value within %part_map}) { |
22
|
0
|
|
|
|
|
|
confess "<datepart> was passed <$datepart> as the datepart, but your database don't support that"; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
else { |
25
|
0
|
|
|
|
|
|
warn $message; |
26
|
|
|
|
|
|
|
} |
27
|
0
|
|
|
|
|
|
}; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $complete = $self->dt_SQL_pluck({ -ident => $column_name }, $datepart); |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my $function_call_string = $complete->$*->[0]; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
return { left_hand_function => { complete => $function_call_string }, value => $value }; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__END__ |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=pod |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=encoding UTF-8 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
DBIx::Class::Smooth::Lookup::DateTime::datepart - Short intro |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 VERSION |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Version 0.0102, released 2019-12-22. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 SOURCE |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
L<https://github.com/Csson/p5-DBIx-Class-Smooth> |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 HOMEPAGE |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
L<https://metacpan.org/release/DBIx-Class-Smooth> |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 AUTHOR |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Erik Carlsson <info@code301.com> |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This software is copyright (c) 2018 by Erik Carlsson. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
69
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |