Don't use given/when

These give warnings in Perl >= 5.18:

  given is experimental at /home/hydra/src/hydra/src/lib/Hydra/Helper/CatalystUtils.pm line 241.
  when is experimental at /home/hydra/src/hydra/src/lib/Hydra/Helper/CatalystUtils.pm line 242.
  ...
This commit is contained in:
Eelco Dolstra
2014-12-12 11:27:17 +01:00
parent e56e743f97
commit c0ca5489e1
4 changed files with 34 additions and 44 deletions

View File

@ -1,7 +1,6 @@
package Hydra::Plugin::CoverityScan;
use strict;
use feature 'switch';
use parent 'Hydra::Plugin';
use File::Basename;
use LWP::UserAgent;
@ -63,14 +62,12 @@ sub buildFinished {
my @exts = qw(.xz .bz2 .lzma .zip .tgz);
my ($dir, $file, $ext) = fileparse($covTarball, @exts);
my $mimetype;
given ($ext) {
when ('.xz') { $mimetype = "application/x-xz"; }
when ('.lzma') { $mimetype = "application/x-xz"; }
when ('.zip') { $mimetype = "application/zip"; }
when ('.bz2') { $mimetype = "application/x-bzip2"; }
when ('.tgz') { $mimetype = "application/x-gzip"; }
default { die "couldn't parse extension of $covTarball"; }
}
if ($ext eq '.xz') { $mimetype = "application/x-xz"; }
elsif ($ext eq '.lzma') { $mimetype = "application/x-xz"; }
elsif ($ext eq '.zip') { $mimetype = "application/zip"; }
elsif ($ext eq '.bz2') { $mimetype = "application/x-bzip2"; }
elsif ($ext eq '.tgz') { $mimetype = "application/x-gzip"; }
else { die "couldn't parse extension of $covTarball"; }
die "couldn't detect mimetype of $covTarball" unless defined $mimetype;