Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=colin.ogilvie, r=vladd, a=justdave
use Bugzilla::Error;
use Bugzilla::Product;
+use List::Util qw(min);
+
use base qw(Exporter);
@Bugzilla::Bug::EXPORT = qw(
AppendComment ValidateComment
use Date::Format;
use Date::Parse;
+use List::Util qw(max);
sub new {
my $invocant = shift;
my $datediff = shift @datediff_total;
push @processed_datediff, $datediff if defined($datediff);
}
- $self->{'y_max_value'} = Bugzilla::Util::max(@processed_datediff);
+ $self->{'y_max_value'} = max(@processed_datediff);
}
else {
- $self->{'y_max_value'} = Bugzilla::Util::max(@maxvals);
+ $self->{'y_max_value'} = max(@maxvals);
}
$self->{'y_max_value'} |= 1; # For log()
html_quote url_quote value_quote xml_quote
css_class_quote
i_am_cgi get_netaddr
- lsearch max min
+ lsearch
diff_arrays diff_strings
trim wrap_comment find_wrap_point
perform_substs
return -1;
}
-sub max {
- my $max = shift(@_);
- foreach my $val (@_) {
- $max = $val if $val > $max;
- }
- return $max;
-}
-
-sub min {
- my $min = shift(@_);
- foreach my $val (@_) {
- $min = $val if $val < $min;
- }
- return $min;
-}
-
sub diff_arrays {
my ($old_ref, $new_ref) = @_;
# Functions for searching
$loc = lsearch(\@arr, $val);
- $val = max($a, $b, $c);
- $val = min($a, $b, $c);
# Data manipulation
($removed, $added) = diff_arrays(\@old, \@new);
If the item is not in the list, returns -1.
-=item C<max($a, $b, ...)>
-
-Returns the maximum from a set of values.
-
-=item C<min($a, $b, ...)>
-
-Returns the minimum from a set of values.
-
=back
=head2 Data Manipulation
use Support::Files;
BEGIN {
- use Test::More tests => 15;
+ use Test::More tests => 13;
use_ok(Bugzilla);
use_ok(Bugzilla::Util);
}
is(lsearch(\@list,'<"\\%'),3,'lsearch 2');
is(lsearch(\@list,'kiwi'),-1,'lsearch 3 (missing item)');
-#max() and min():
-@list = (7,27,636,2);
-is(max(@list),636,'max()');
-is(min(@list),2,'min()');
-
#trim():
is(trim(" fg<*\$%>+=~~ "),'fg<*$%>+=~~','trim()');
use Bugzilla::User;
use Bugzilla::Product;
+use List::Util qw(min);
+
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $vars = {};