Name : perl-YAML-Logic
| |
Version : 0.07
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp154.1.1
| Date : 2023-01-27 16:40:35
|
Group : Development/Libraries/Perl
| Source RPM : perl-YAML-Logic-0.07-lp154.1.1.src.rpm
|
Size : 0.03 MB
| |
Packager : https://www_suse_com/
| |
Summary : Simple boolean logic in YAML
|
Description :
YAML::Logic allows users to define simple boolean logic in a configuration file, without permitting them to run arbitrary code.
While Perl code can be controlled with the \'Safe\' module, \'Safe\' can\'t prevent the user from defining infinite loops, exhausting all available memory or crashing the interpreter by exploiting well-known perl bugs. YAML::Logic isn\'t perfect in this regard either, but it makes it reasonably hard to define harmful code.
The syntax for the boolean logic within a YAML file was inspired by John Siracusa\'s \'Rose::DB::Object::QueryBuilder\' module, which provides data structures to define logic that is then transformed into SQL. YAML::Logic takes the data structure instead and transforms it into Perl code.
For example, the data structure to check whether a variable \'$var\' is equal to a value \"foo\", looks like this:
[$var, \"foo\"]
It\'s a reference to an array containing both the value of the variable and the value to compare it with. In YAML, this looks like
rule: - $var - foo
and this is exactly the syntax that YAML::Logic accepts. Note that after parsing the YAML configuration above, you need to pass _only_ the array ref inside the \'rule\' entry to YAML::Logic\'s \'evaluate()\' method:
$logic->evaluate( $yaml_data->{rule}, ...
Passing the entire YAML data would cause an error with YAML::Logic, as it expects to receive an array ref.
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-Y/15.4/noarch |