Skip to content

Instantly share code, notes, and snippets.

@robinsmidsrod
Created February 13, 2018 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robinsmidsrod/f8d5ab88dfe383f3aca40155ccec7d32 to your computer and use it in GitHub Desktop.
Save robinsmidsrod/f8d5ab88dfe383f3aca40155ccec7d32 to your computer and use it in GitHub Desktop.
Fix issue with given/when experimental in newer Perl versions
diff --git a/src/util/niclist.pl b/src/util/niclist.pl
index 0600c823..f6e70e5b 100755
--- a/src/util/niclist.pl
+++ b/src/util/niclist.pl
@@ -50,23 +50,20 @@ Column names (default order):
EOM
# Only load runtime requirements if actually in use
-given($format) {
- when( /csv/ ) {
- eval { require Text::CSV; };
- die("Please install Text::CSV CPAN module to use this feature.\n")
- if $@;
- }
- when( /json/ ) {
- eval { require JSON; };
- die("Please install JSON CPAN module to use this feature.\n")
- if $@;
- }
- when( /html/ ) {
- eval { require HTML::Entities; };
- die("Please install HTML::Entities CPAN module to use this feature.\n")
- if $@;
- }
- default { }
+if ( $format =~ /csv/ ) {
+ eval { require Text::CSV; };
+ die("Please install Text::CSV CPAN module to use this feature.\n")
+ if $@;
+}
+if ( $format =~ /json/ ) {
+ eval { require JSON; };
+ die("Please install JSON CPAN module to use this feature.\n")
+ if $@;
+}
+if ( $format =~ /html/ ) {
+ eval { require HTML::Entities; };
+ die("Please install HTML::Entities CPAN module to use this feature.\n")
+ if $@;
}
# Scan source dir and build NIC list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment