void-packages/srcpkgs/chromium/patches/perl_deprecated_switch_module_use_givenwhen.patch

134 lines
5.6 KiB
Diff

perl-5.14 deprecated the Switch module. We can use the given/when statement instead,
available since 5.10. Submitted upstream:
http://code.google.com/p/chromium/issues/detail?id=86645
--- third_party/WebKit/Source/WebKit/scripts/generate-webkitversion.pl.orig 2011-06-18 11:13:44.104816166 +0200
+++ third_party/WebKit/Source/WebKit/scripts/generate-webkitversion.pl 2011-06-18 11:14:10.238814221 +0200
@@ -39,7 +39,6 @@ use strict;
use Config;
use Getopt::Long;
use File::Path;
-use Switch;
my $usage = "generate-webkitversion --config WebKit/mac/Configurations/Version.xcconfig --outputDir <outputdir>";
--- chrome/tools/test/generate_mime_tests.pl.orig 2011-06-14 10:01:52.000000000 +0200
+++ chrome/tools/test/generate_mime_tests.pl 2011-06-18 11:48:40.093660143 +0200
@@ -32,7 +32,7 @@
# the layout test framework.
use strict;
-use Switch; # used for switch-case program structure
+use feature qw(switch);
my $arg_count = $#ARGV + 1;
@@ -161,15 +161,15 @@ my @expected = (
# Output : returns the associated description
sub get_result_description
{
- switch ($_[0]) {
- case "void" { return "NOTHING";}
- case "image" { return "an IMAGE";}
- case "text" { return "simple TEXT";}
- case "html" { return "an HTML as text";}
- case "flash" { return "a FLASH object"}
- case "rs" { return "been RENDERED CORRECTLY";}
- case "rf" { return "been RENDERED INCORRECTLY";}
- else { return "UNKNOWN";}
+ given ($_[0]) {
+ when ('void') { return "NOTHING";}
+ when ('image') { return "an IMAGE";}
+ when ('text') { return "simple TEXT";}
+ when ('html') { return "an HTML as text";}
+ when ('flash') { return "a FLASH object"}
+ when ('rs') { return "been RENDERED CORRECTLY";}
+ when ('rf') { return "been RENDERED INCORRECTLY";}
+ default { return "UNKNOWN";}
}
}
@@ -180,22 +180,22 @@ sub get_result_description
# Output : returns the associated description
sub get_query_description
{
- switch ($_[0]) {
- case "tag=img&content=type_gif.gif" { return "HTML page with a GIF image";}
- case "tag=img&content=type_bmp.bmp" { return "HTML page with a BMP image";}
- case "tag=img&content=type_tif.tif" { return "HTML page with a TIF image";}
- case "tag=img&content=type_png.png" { return "HTML page with a PNG image";}
- case "tag=img&content=type_jpg.jpg" { return "HTML page with a JPEG image"}
- case "tag=img&content=type_txt.txt" { return "HTML page";}
- case "tag=embed&content=type_swf.swf" { return "an HTML page with a FLASH object";}
- case "switch=nohtml&content=type_gif.gif" { return "GIF image and no HTML";}
- case "switch=nohtml&content=type_bmp.bmp" { return "BMP image and no HTML";}
- case "switch=nohtml&content=type_tif.tif" { return "TIF image and no HTML";}
- case "switch=nohtml&content=type_png.png" { return "PNG image and no HTML";}
- case "switch=nohtml&content=type_jpg.jpg" { return "JPEG image and no HTML"}
- case "switch=nohtml&content=type_txt.txt" { return "simple TEXT and no HTML";}
- case "switch=nohtml&content=type_swf.swf" { return "FLASH object and no HTML";}
- else { return "UNKNOWN TYPE";}
+ given ($_[0]) {
+ when ('tag=img&content=type_gif.gif') { return "HTML page with a GIF image";}
+ when ('tag=img&content=type_bmp.bmp') { return "HTML page with a BMP image";}
+ when ('tag=img&content=type_tif.tif') { return "HTML page with a TIF image";}
+ when ('tag=img&content=type_png.png') { return "HTML page with a PNG image";}
+ when ('tag=img&content=type_jpg.jpg') { return "HTML page with a JPEG image"}
+ when ('tag=img&content=type_txt.txt') { return "HTML page";}
+ when ('tag=embed&content=type_swf.swf') { return "an HTML page with a FLASH object";}
+ when ('switch=nohtml&content=type_gif.gif') { return "GIF image and no HTML";}
+ when ('switch=nohtml&content=type_bmp.bmp') { return "BMP image and no HTML";}
+ when ('switch=nohtml&content=type_tif.tif') { return "TIF image and no HTML";}
+ when ('switch=nohtml&content=type_png.png') { return "PNG image and no HTML";}
+ when ('switch=nohtml&content=type_jpg.jpg') { return "JPEG image and no HTML"}
+ when ('switch=nohtml&content=type_txt.txt') { return "simple TEXT and no HTML";}
+ when ('switch=nohtml&content=type_swf.swf') { return "FLASH object and no HTML";}
+ default { return "UNKNOWN TYPE";}
}
}
--- third_party/WebKit/Source/WebCore/make-hash-tools.pl.orig 2011-06-14 10:04:55.000000000 +0200
+++ third_party/WebKit/Source/WebCore/make-hash-tools.pl 2011-06-18 11:49:02.502658474 +0200
@@ -20,7 +20,7 @@
# Boston, MA 02110-1301, USA.
use strict;
-use Switch;
+use feature qw(switch);
use File::Basename;
my $outdir = $ARGV[0];
@@ -28,9 +28,9 @@ shift;
my $option = basename($ARGV[0],".gperf");
-switch ($option) {
+given ($option) {
-case "DocTypeStrings" {
+when ('DocTypeStrings') {
my $docTypeStringsGenerated = "$outdir/DocTypeStrings.cpp";
my $docTypeStringsGperf = $ARGV[0];
@@ -38,9 +38,9 @@ case "DocTypeStrings" {
system("gperf --key-positions=\"*\" -s 2 $docTypeStringsGperf > $docTypeStringsGenerated") == 0 || die "calling gperf failed: $?";
-} # case "DocTypeStrings"
+} # when "DocTypeStrings"
-case "ColorData" {
+when ('ColorData') {
my $colorDataGenerated = "$outdir/ColorData.cpp";
my $colorDataGperf = $ARGV[0];
@@ -48,6 +48,6 @@ case "ColorData" {
system("gperf --key-positions=\"*\" -D -s 2 $colorDataGperf > $colorDataGenerated") == 0 || die "calling gperf failed: $?";
-} # case "ColorData"
+} # when "ColorData"
-} # switch ($option)
+} # given ($option)