Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.