diff --git a/smradius/util.pm b/smradius/util.pm index 4512b3320690ee08dba01785231c5a843828f4cd..9557044fccf42f4ca6de1c22555e2cc6c0b7fd90 100644 --- a/smradius/util.pm +++ b/smradius/util.pm @@ -28,11 +28,27 @@ require Exporter; our (@ISA,@EXPORT); @ISA = qw(Exporter); @EXPORT = qw( + niceUndef templateReplace ); +## @fn niceUndef($string) +# If string defined return 'string', or if undefined return -undef- +# +# @param string String to check +# +# @return Return 'string' if defined, or -undef- otherwise +sub niceUndef +{ + my $string = shift; + + + return defined($string) ? "'$string'" : '-undef-'; +} + + ## @fn templateReplace($string,$hashref) # Template string replacer function #