Bug 11474: Remove errors caused by use of given/when statement

This patch replaces a given/when statement by an if so we
do not get warnings on compilation when using Perl 5.18 or later.

Note the perldoc for the subroutine was not correct;
code was not testing that paramater equalled the values
but that it contained them. Have amended accordingly

Have documented behaviour in case parameter contains
neither value.

Subroutine does not appear to me used elsewhere in
codebase

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script, especially t/DateUtils.t.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Colin Campbell 2014-01-03 10:47:23 +00:00 committed by Galen Charlton
parent e45edca42a
commit 690fbfbb8a

View file

@ -266,19 +266,19 @@ sub dt_build_query_dates {
It calls dt_build_query_dates or dt_build_query_simple fonction of $type.
$type can be 'simple' or 'rage_dates'.
$type can contain 'simple' or 'rage_dates'.
if $type is not matched it returns undef
=cut
sub dt_build_query {
my ( $type, @params ) = @_;
given ( $type ) {
when ( /simple/ ) {
if ( $type =~ m/simple/ ) {
return dt_build_query_simple(@params);
}
when ( /range_dates/ ) {
elsif ( $type =~ m/range_dates/ ) {
return dt_build_query_dates(@params);
}
}
return;
}
1;