NAME
Config::INI::RefVars::Builtins - Built-in functions for Config::INI::RefVars
VERSION
Version 1.00
SYNOPSIS
use Config::INI::RefVars::Builtins ();
my $dispatch =
Config::INI::RefVars::Builtins::default_dispatch_table();
DESCRIPTION
This module contains the built-in functions used by Config::INI::RefVars.
It is primarily an internal module. Applications normally access built-in functions indirectly via the $(=& ...) syntax.
Example:
[section]
path = $(=& catdir,foo,bar)
FUNCTIONS
default_dispatch_table
my $dispatch =
Config::INI::RefVars::Builtins::default_dispatch_table();
Returns a hash reference containing all built-in functions.
The returned hash reference may be modified without affecting other parser objects.
BUILT-IN FUNCTIONS
Built-in functions are called using the $(=& ...) syntax.
Example:
path = $(=& catdir,foo,bar)
catdir
$(=& catdir,arg1,arg2,...)
Equivalent to:
File::Spec::Functions::catdir(...)
catfile
$(=& catfile,arg1,arg2,...)
Equivalent to:
File::Spec::Functions::catfile(...)
ignore
$(=& ignore,...)
Ignores all arguments and returns the empty string.
concat
$(=& concat,arg1,arg2,...)
Concatenates all arguments.
Example:
$(=& concat,foo,bar,baz)
Result: foobarbaz
join
$(=& join,separator,arg1,arg2,...)
Equivalent to Perl's join() function.
Example:
$(=& join,:,foo,bar,baz)
Result: foo:bar:baz
substr
$(=& substr,string,offset)
$(=& substr,string,offset,length)
Equivalent to Perl's substr() function.
Examples:
-
$(=& substr,abcdef,2)Result:
cdef -
$(=& substr,abcdef,2,3)Result:
cde
x
$(=& x,string,count)
Equivalent to Perl's string repetition operator.
Example:
$(=& x,ab,3)
Result: ababab
and
$(=& and,arg1,arg2,...)
Returns the last argument if all arguments are non-empty. Otherwise returns the empty string.
Examples:
-
$(=& and,a,b,c)Result:
c -
$(=& and,a,,c)Result:
""
or
$(=& or,arg1,arg2,...)
Returns the first non-empty argument.
Examples:
-
$(=& or,,b,c)Result:
b -
$(=& or,,,)Result:
""
if
$(=& if,condition,true-value)
$(=& if,condition,true-value,false-value)
Returns true-value if condition is non-empty. Otherwise returns false-value, or the empty string if no false-value was specified.
Examples:
-
$(=& if,yes,foo,bar)Result:
foo -
$(=& if,,foo,bar)Result:
bar
s
$(=& s,string,pattern,replacement)
$(=& s,string,pattern,replacement,modifiers)
Performs a regular-expression substitution and returns the resulting string.
Supported modifiers:
g i m s x
The e modifier is not supported.
Regex code blocks are rejected:
(?{ ... })
(??{ ... })
tr
$(=& tr,string,search,replacement)
$(=& tr,string,search,replacement,modifiers)
Performs a character transliteration and returns the resulting string.
Supported modifiers:
c d s
Examples:
-
$(=& tr,abcabc,a,x)Result:
xbcxbc -
$(=& tr,abcabc,abc,ABC)Result:
ABCABC
m
$(=& m, STRING, PATTERN)
$(=& m, STRING, PATTERN, MODIFIERS)
Performs a regular-expression match.
Returns 1 if the pattern matches and the empty string otherwise.
Supported modifiers:
i m s x
Regex code blocks are rejected.
Examples:
-
$(=& m, abc123, \d+)Result:
1 -
$(=& m, abc, \d+)Result:
""
not
$(=& not, VALUE)
Returns 1 if VALUE is the empty string and the empty string otherwise.
eq
$(=& eq, STRING1, STRING2)
Returns 1 if both strings are equal and the empty string otherwise.
dirname
$(=& dirname, PATH)
Equivalent to File::Basename::dirname().
basename
$(=& basename, PATH)
Equivalent to File::Basename::basename().
FUTURE EXTENSIONS
Additional built-in functions may be added in future releases.
Applications should therefore avoid relying on the absence of specific function names.
SEE ALSO
Config::INI::RefVars, File::Basename, File::Spec::Functions
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Config::INI::RefVars
You can also look for information here: Config::INI::RefVars
LICENSE AND COPYRIGHT
This software is copyright (c) 2026 by Abdul al Hazred.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.