| 1 | 10 | ▶ | use 5.20.0; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 10 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 10 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | package DBIx::Class::Smooth::Lookup::DateTime::datepart; | ||||||||||
| 6 | |||||||||||
| 7 | # ABSTRACT: Short intro | ||||||||||
| 8 | 10 | our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY | |||||||||
| 9 | 10 | our $VERSION = '0.0104'; | |||||||||
| 10 | |||||||||||
| 11 | 10 | ▶ | use parent 'DBIx::Class::Smooth::Lookup::Util'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 10 | ▶ | use Carp qw/carp confess/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 10 | ▶ | use experimental qw/signatures postderef/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | ▶ | sub smooth__lookup__datepart($self, $column_name, $value, $params, @rest) { | |||||||||
|
Subroutine
smooth__lookup__datepart: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 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 | ▶ | local $SIG{'__WARN__'} = sub ($message) { | |||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 21 | 0 | ▶ | if($message =~ m{uninitialized value within %part_map}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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 | 10 | 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.0104, released 2020-08-30. | ||||||||||
| 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 | ||||||||||