[X2Go-Commits] [x2goserver] 11/30: x2goserver/lib/x2go{is{int, true}, updateoptionsstring}: wrap print calls with filehandles in curly braces.

git-admin at x2go.org git-admin at x2go.org
Thu Dec 13 11:22:47 CET 2018


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goserver.

commit 3bbaa1965c12e169eae3f8ebe090c6252ff1cde9
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Sat Dec 8 01:47:27 2018 +0100

    x2goserver/lib/x2go{is{int,true},updateoptionsstring}: wrap print calls with filehandles in curly braces.
---
 debian/changelog                       |  2 ++
 x2goserver/lib/x2goisint               |  2 +-
 x2goserver/lib/x2goistrue              |  2 +-
 x2goserver/lib/x2goupdateoptionsstring | 32 ++++++++++++++++----------------
 4 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 0bf8354..a96df9e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -29,6 +29,8 @@ x2goserver (4.1.0.4-0x2go1) UNRELEASED; urgency=medium
       code that uses this new function.
     - x2goserver/lib/x2go{is{int,true},updateoptionsstring}: use q{} instead
       of empty quotes as per some... coding standard.
+    - x2goserver/lib/x2go{is{int,true},updateoptionsstring}: wrap print calls
+      with filehandles in curly braces.
   * debian/control:
     + Build-depend upon lsb-release for distro version detection.
   * debian/x2goserver.manpages:
diff --git a/x2goserver/lib/x2goisint b/x2goserver/lib/x2goisint
index c7e013e..add1008 100755
--- a/x2goserver/lib/x2goisint
+++ b/x2goserver/lib/x2goisint
@@ -26,7 +26,7 @@ my $value = shift;
 my $allow_negative = shift;
 
 if (!(defined ($value))) {
-  print STDERR "No value passed in, assuming empty string.\n";
+  print {*STDERR} "No value passed in, assuming empty string.\n";
   $value = q{};
 }
 
diff --git a/x2goserver/lib/x2goistrue b/x2goserver/lib/x2goistrue
index f2ab8d8..b231ae9 100755
--- a/x2goserver/lib/x2goistrue
+++ b/x2goserver/lib/x2goistrue
@@ -25,7 +25,7 @@ use X2Go::Utils qw (is_true);
 my $value = shift;
 
 if (!(defined ($value))) {
-  print STDERR "No value passed in, assuming empty string.\n";
+  print {*STDERR} "No value passed in, assuming empty string.\n";
   $value = q{};
 }
 
diff --git a/x2goserver/lib/x2goupdateoptionsstring b/x2goserver/lib/x2goupdateoptionsstring
index b9b3fe8..901a409 100755
--- a/x2goserver/lib/x2goupdateoptionsstring
+++ b/x2goserver/lib/x2goupdateoptionsstring
@@ -48,11 +48,11 @@ sub parse_options {
   my $next_discard = shift;
 
   if (defined ($next_discard)) {
-    print STDERR "Multiple arguments passed in, all but the first one are ignored!\n";
+    print {*STDERR} "Multiple arguments passed in, all but the first one are ignored!\n";
   }
 
   if (!(defined ($options))) {
-    print STDERR "No argument provided for options string, returning undef.\n";
+    print {*STDERR} "No argument provided for options string, returning undef.\n";
     $error_detected = 1;
   }
 
@@ -67,12 +67,12 @@ sub parse_options {
       my @kv = split (/=/, $option, 2);
 
       if (1 > scalar (@kv)) {
-        print STDERR "Options string has empty component, this is deprecated. Adding empty element.\n";
+        print {*STDERR} "Options string has empty component, this is deprecated. Adding empty element.\n";
 
         push (@intermediate, \%kv_hash);
       }
       elsif (3 <= scalar (@kv)) {
-        print STDERR "Options string has three or more components, this is a bug in $0. Erroring out.\n";
+        print {*STDERR} "Options string has three or more components, this is a bug in $0. Erroring out.\n";
         $error_detected = 1;
         last;
       }
@@ -107,7 +107,7 @@ sub parse_options {
           ++$hash_count;
 
           if (1 < $hash_count) {
-            print STDERR "More than one element found in last element's hash, this is a bug in $0. Ignoring subsequent entries.\n";
+            print {*STDERR} "More than one element found in last element's hash, this is a bug in $0. Ignoring subsequent entries.\n";
             last;
           }
 
@@ -129,7 +129,7 @@ sub parse_options {
         my $last_pos = rindex ($last_component, ':');
 
         if ($[ > $last_pos) {
-          print STDERR "No display port seperator found in the options string. Erroring out.\n";
+          print {*STDERR} "No display port seperator found in the options string. Erroring out.\n";
           $error_detected = 1;
         }
         else {
@@ -145,7 +145,7 @@ sub parse_options {
             # Sanity check on the key. If it's empty, issue a warning and don't
             # use it.
             if (0 == length ($last_component_left)) {
-              print STDERR "Options string has empty component, this is deprecated. Adding empty element.\n";
+              print {*STDERR} "Options string has empty component, this is deprecated. Adding empty element.\n";
             }
             else {
               $last_component_hash{$last_component_left} = undef;
@@ -188,7 +188,7 @@ sub intermediate_to_string {
   my $options = shift;
 
   if ('ARRAY' ne ref ($options)) {
-    print STDERR "Invalid options reference type passed (" . ref ($options) . "), returning undef.\n";
+    print {*STDERR} "Invalid options reference type passed (" . ref ($options) . "), returning undef.\n";
     $error_detected = 1;
   }
 
@@ -196,7 +196,7 @@ sub intermediate_to_string {
     if (1 == scalar (@$options)) {
       foreach my $entry (@$options) {
         if (!defined ($entry)) {
-          print STDERR "Invalid options array passed, returning undef.\n";
+          print {*STDERR} "Invalid options array passed, returning undef.\n";
           $error_detected = 1;
         }
       }
@@ -213,19 +213,19 @@ sub intermediate_to_string {
       --$elements_left;
 
       if (!defined ($entry)) {
-        print STDERR "Invalid options entry encountered, returning undef.\n";
+        print {*STDERR} "Invalid options entry encountered, returning undef.\n";
         $error_detected = 1;
         last;
       }
 
       if ('HASH' ne ref ($entry)) {
-        print STDERR "Entry in array has invalid type (" . ref ($entry) ."), returning undef.\n";
+        print {*STDERR} "Entry in array has invalid type (" . ref ($entry) ."), returning undef.\n";
         $error_detected = 1;
         last;
       }
 
       if (1 < scalar (keys (%$entry))) {
-        print STDERR "More than one entry encountered in hash of current element, returning undef.\n";
+        print {*STDERR} "More than one entry encountered in hash of current element, returning undef.\n";
         $error_detected = 1;
         last;
       }
@@ -244,7 +244,7 @@ sub intermediate_to_string {
         else {
           # Special handling for last element, which is always supposed to
           # contain the display port.
-          print STDERR "No entry found in display port hash, returning undef.\n";
+          print {*STDERR} "No entry found in display port hash, returning undef.\n";
           $error_detected = 1;
           last;
         }
@@ -297,15 +297,15 @@ my $options = shift;
 
 my $intermediate = parse_options ($options);
 
-print STDERR Dumper ($intermediate) . "\n";
+print {*STDERR} Dumper ($intermediate) . "\n";
 
-print STDERR Dumper (intermediate_to_string ($intermediate)) . "\n";
+print {*STDERR} Dumper (intermediate_to_string ($intermediate)) . "\n";
 
 #my $value = shift;
 #my $allow_negative = shift;
 #
 #if (!(defined ($value))) {
-#  print STDERR "No value passed in, assuming empty string.\n";
+#  print {*STDERR} "No value passed in, assuming empty string.\n";
 #  $value = q{};
 #}
 #

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git


More information about the x2go-commits mailing list