summaryrefslogtreecommitdiff
path: root/README.markdown
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2014-05-21 22:03:04 +0200
committerGuido Günther <agx@sigxcpu.org>2014-05-22 21:52:11 +0200
commit6b9bc57547e7bc84b17f33a4807f22be6bf91ecb (patch)
treebf2ceb234c0ac842c752222cc5f17a1978390457 /README.markdown
parentc4abfdae1bcc4f24606467e43b738cc412f98741 (diff)
Add validate_nonemptystring_msg
This allows to print a custom message when the string is not valid but only accepts a single argument.
Diffstat (limited to 'README.markdown')
-rw-r--r--README.markdown18
1 files changed, 17 insertions, 1 deletions
diff --git a/README.markdown b/README.markdown
index 4761f9d..96b4b6e 100644
--- a/README.markdown
+++ b/README.markdown
@@ -25,6 +25,23 @@ The following values will fail, causing compilation to abort:
$undefined = undef
validate_nonemptystring($undefined)
+validate_nonemptystring_msg
+---------------------------
+Validate that the passed value is string data and not empty i.e. not
+undef or ''. Abort catalog compilation if it fails this check and
+print the message given as second argment.
+
+The following values will pass:
+
+ $my_string = "one two"
+ validate_nonemptystring_msg($my_string, 'Not a string')
+
+The following values will fail, causing compilation to abort and print
+'Not a string':
+
+ validate_nonemptystring_msg(true. 'Not a string')
+ validate_nonemptystring_msg([ 'some', 'array' ], 'Not a string')
+
validate_nonemptyarray
----------------------
Validate that all passed values are array data structures. Abort
@@ -43,4 +60,3 @@ The following values will fail, causing compilation to abort:
validate_nonemptyarray('some_string')
$undefined = undef
validate_nonemptyarray($undefined)
-