[X2Go-Commits] [x2goserver] 02/30: X2Go/Utils.pm: add new is_int subroutine, checking if the provided value is an integer.
git-admin at x2go.org
git-admin at x2go.org
Thu Dec 13 11:22:46 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 3e24f3211617aa10d3c0a48610181ec90f541624
Author: Mihai Moldovan <ionic at ionic.de>
Date: Wed Dec 5 08:30:48 2018 +0100
X2Go/Utils.pm: add new is_int subroutine, checking if the provided value is an integer.
---
X2Go/Utils.pm | 19 ++++++++++++++++++-
debian/changelog | 2 ++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/X2Go/Utils.pm b/X2Go/Utils.pm
index 234702c..4a4c7a2 100644
--- a/X2Go/Utils.pm
+++ b/X2Go/Utils.pm
@@ -37,7 +37,7 @@ use strict;
use base 'Exporter';
-our @EXPORT = ( 'load_module', 'is_true',
+our @EXPORT = ( 'load_module', 'is_true', 'is_int',
'source_environment', 'clups', 'sanitizer',
'system_capture_merged_output', 'system_capture_stdout_output',
'check_x2go_sessionid');
@@ -61,6 +61,23 @@ sub is_true {
return 0;
}
+sub is_int {
+ my $value = shift;
+ my $allow_negative = shift;
+
+ if (!(defined ($allow_negative))) {
+ $allow_negative = 0;
+ }
+
+ if ($allow_negative) {
+ return 1 if $value =~ m/-?\d+/;
+ }
+ else {
+ return 1 if $value =~ m/\d+/;
+ }
+
+ return 0;
+}
sub source_environment {
my $name = shift;
diff --git a/debian/changelog b/debian/changelog
index 4e58012..e92aa36 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,8 @@ x2goserver (4.1.0.4-0x2go1) UNRELEASED; urgency=medium
- x2goserver-x2goagent/man/man1/x2goagent.1: add version and date.
- x2goserver/Makefile: generate man pages from Perl POD.
- X2Go/Utils.pm: fix missing semicolons.
+ - X2Go/Utils.pm: add new is_int subroutine, checking if the provided value
+ is an integer.
* debian/control:
+ Build-depend upon lsb-release for distro version detection.
* debian/x2goserver.manpages:
--
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