From 811d1e0b1feec8f2608020c216bff09ae9fb98ca Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 5 Jul 2004 06:22:26 +0000 Subject: - more perlish behaviour for to_int() and to_float() (skipping leading spaces) --- MDK/Common.pm.pl | 2 +- MDK/Common/Various.pm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'MDK') diff --git a/MDK/Common.pm.pl b/MDK/Common.pm.pl index fea6a8f..2ac0e37 100644 --- a/MDK/Common.pm.pl +++ b/MDK/Common.pm.pl @@ -74,7 +74,7 @@ use vars qw(@ISA @EXPORT $VERSION); #); # perl_checker: RE-EXPORT-ALL @EXPORT = map { @$_ } map { values %{'MDK::Common::' . $_ . 'EXPORT_TAGS'} } grep { /::$/ } keys %MDK::Common::; -$VERSION = "1.1.13"; +$VERSION = "1.1.14"; 1; EOF diff --git a/MDK/Common/Various.pm b/MDK/Common/Various.pm index eba2faf..7072aad 100644 --- a/MDK/Common/Various.pm +++ b/MDK/Common/Various.pm @@ -107,8 +107,8 @@ sub second { $_[1] } sub top { $_[-1] } sub to_bool { $_[0] ? 1 : 0 } -sub to_int { $_[0] =~ /(\d*)/ && $1 } -sub to_float { $_[0] =~ /(\d*(\.\d*)?)/ && $1 } +sub to_int { $_[0] =~ /\s*(\d*)/ && $1 } +sub to_float { $_[0] =~ /\s*(\d*(\.\d*)?)/ && $1 } sub bool2text { $_[0] ? "true" : "false" } sub bool2yesno { $_[0] ? "yes" : "no" } sub text2bool { my $t = lc($_[0]); $t eq "true" || $t eq "yes" ? 1 : 0 } -- cgit v1.2.1