String::Interpolate::Shell - Variable interpolation, shell style
use String::Interpolate::Shell qw[ strinterp ];
$interpolated_text = strinterp( $text, \%var, \%attr );
String::Interpolate::Shell interpolates variables into strings. Variables are specified using a syntax similar to that use by bash. Undefined variables can be silently ignored, removed from the string, can cause warnings to be issued or errors to be thrown.
Insert the value of the variable.
Insert the value of the variable. If it is not defined, the routine croaks with the specified message.
Insert the value of the variable. If it is not defined, process the specified default text for any variable interpolations and insert the result.
If the variable is defined, insert the result of interpolating any variables into the default text.
Insert the value of the variable. If it is not defined, insert the result of interpolating any variables into the default text and set the variable to the same value.
Insert the value of the variable as formatted according to the specified sprintf compatible format.
Insert the modified value of the variable. The modification is specified by op, which may be any of s, tr, or y, corresponding to the Perl operators of the same name. Delimiters for the modification may be any of those recognized by Perl. The modification is performed using a Perl string eval.
In any of the bracketed forms, if the variable name is preceded with an exclamation mark (!) the name of the variable to be interpreted is taken from the value of the specified variable.
$interpolated_text = strinterp( $template, \%var, \%attr );
Return a string containing a copy of $template with variables interpolated.
%var contains the variable names and values.
%attr may contain the following entries:
This indicates how undefined variables should be interpolated
Ignore them. The token in $text is left as is.
Remove the token from $text.
This indicates how undefined variables should be reported.
No message is returned.
A message is output via carp().
A message is output via croak().
You can make new bug reports, and view existing ones, through the web interface at https://rt.cpan.org/Public/Dist/Display.html?Name=String-Interpolate-Shell.
Diab Jerius <email@example.com>
This software is Copyright (c) 2017 by Smithsonian Astrophysical Observatory.
This is free software, licensed under:
The GNU General Public License, Version 3, June 2007
To install String::Interpolate::Shell, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.