use Mail::Address;
use POSIX qw(ceil);
use Storable qw(dclone);
+use Scalar::Util qw(looks_like_number);
use List::AllUtils qw(max);
use File::stat;
}
if ($has_options) {
push @links,
- munge_url('pkgreport.cgi?',
+ (munge_url('pkgreport.cgi?',
%options,
$t_type => $target,
- );
+ ),
+ $target);
} else {
push @links,
('pkgreport.cgi?'.$t_type.'='.uri_escape_utf8($target),
=cut
sub bug_links {
+ state $spec = {bug => {type => SCALAR|ARRAYREF,
+ optional => 1,
+ },
+ links_only => {type => BOOLEAN,
+ default => 0,
+ },
+ class => {type => SCALAR,
+ default => '',
+ },
+ separator => {type => SCALAR,
+ default => ', ',
+ },
+ options => {type => HASHREF,
+ default => {},
+ },
+ };
my %param = validate_with(params => \@_,
- spec => {bug => {type => SCALAR|ARRAYREF,
- optional => 1,
- },
- links_only => {type => BOOLEAN,
- default => 0,
- },
- class => {type => SCALAR,
- default => '',
- },
- separator => {type => SCALAR,
- default => ', ',
- },
- options => {type => HASHREF,
- default => {},
- },
- },
+ spec => $spec,
);
my %options = %{$param{options}};
$_);
} make_list($param{bug}) if exists $param{bug};
} else {
- push @links, map {'bugreport.cgi?bug='.uri_escape_utf8($_)}
+ push @links,
+ map {my $b = ceil($_);
+ ('bugreport.cgi?bug='.$b,
+ $b)}
+ grep {looks_like_number($_)}
make_list($param{bug}) if exists $param{bug};
}
my @return;