Advanced-Config
view release on metacpan or search on metacpan
t/config/40-validate-modifiers.cfg view on Meta::CPAN
#
# This is a sample test file I'm using to validate the variable modifiers!
# It's used by t/40-validate-modifiers.t
#
# Every time you modify this config file, you must update the test script as
# well! That script must reference everything defined in this file and
# vice versa!
#
msg = Be liberal in what you accept, and conservative in what you send.
# Tests out the Substring removal options ....
a = ${msg#* } # Drops the word "Be " from ${msg}.
b = ${msg##* } # Removes everything except "send." from ${msg} [Greedy]
c = ${msg% *} # Drops the trailing " send." from ${msg}.
d = ${msg%% *} # Keeps just the 1st word "Be" from ${msg}. [Greedy]
# Drops "Be liberal " from ${msg} -- Can't be nested!
a2 = ${msg#* }
a2 = ${a2#* }
# Drops the trailing " you send." from ${msg}. -- Can't be nested!
c2 = ${msg% *}
c2 = ${c2% *}
# Just keeps "liberal" from ${msg}. -- Can't be nested!
e2 = ${msg#* }
e2 = ${e2%% *}
len = ${#msg} # Returns how long ${msg} is. 65 chars.
# ---------------------------------------------------------------------------
cd = "call die"
# Evaluates :? & ? --> Call's die if the variable doesn't exist ...
# Commented out ${die1} since calls die while the config file is loading!
# :? Calls die when ${abc} doesn't exist or has no value!
# abc =
# die1 = ${abc:?Did we ${cd} yet?} # ${abc} doesn't exist, so call die!
# die1 = ${abc:?} # ${abc} doesn't exist, so call die with can't msg!
die2 = ${msg:?Will we ${cd}?} # ${msg} does exist, so die not called!
# ? doesn't call die when the variable is set but has no value.
# So comment out ${abcd} to get things to die while loading!
abcd =
die3 = ${abcd?Did we ${cd} today?} # ${abc} doesn't exist, so call die!
die4 = ${msg?Will we ${cd}?} # ${msg} does exist, so call die not called!
# Evaluates :- & - --> Use a default value if unset!
def0 = The unknown soldier
def1 = ${unknown:-${def0}.}
def2 = ${d:-The known value!}
def3 = ${unknown-${def0} 2.}
def4 = ${abcd-Set to "".}
def5 = ${d-Another known value!}
# Evaluates := & = --> Assign a Default value if unset!
# Dynamically adds ${zebra} & ${elephant} to the config file.
awa = A
( run in 0.882 second using v1.01-cache-2.11-cpan-39bf76dae61 )