[pacman-dev] [PATCH] makepkg-template: Stop using given/when

Florian Pritz bluewind at xinu.at
Wed May 22 10:35:23 EDT 2013


given/when has been marked experimental in perl 5.18 because it will
change it 5.20. if/else is ugly, but hiding the generated warning is no
good solution either, so we us if/else for now.

Signed-off-by: Florian Pritz <bluewind at xinu.at>
---
 scripts/makepkg-template.pl.in | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/scripts/makepkg-template.pl.in b/scripts/makepkg-template.pl.in
index 6997a83..7e37799 100755
--- a/scripts/makepkg-template.pl.in
+++ b/scripts/makepkg-template.pl.in
@@ -120,21 +120,15 @@ sub process_file {
 		if ($line =~ $template_marker) {
 			my $values = parse_template_line($line, $filename, $linenumber);
 
-			given ($values->{command}) {
-				when (['start', 'input']) {
-					if ($nesting_level == 0) {
-						$ret .= load_template($values);
-					}
-				}
-
-				when ('end') {
-					# nothing to do here, just for completeness
-				}
-
-				default {
-					die sprintf(gettext("Unknown template marker '%s'\n"), $values->{command}),
-						"$filename:$linenumber: $line";
+			if ($values->{command} eq "start" or $values->{command} eq "input") {
+				if ($nesting_level == 0) {
+					$ret .= load_template($values);
 				}
+			} elsif ($values->{command} eq "end") {
+				# nothing to do here, just for completeness
+			} else {
+				die sprintf(gettext("Unknown template marker '%s'\n"), $values->{command}),
+					"$filename:$linenumber: $line";
 			}
 
 			$nesting_level++ if $values->{command} eq "start";
-- 
1.8.2.3


More information about the pacman-dev mailing list