NAME
Catmandu::Fix::Condition::in - only execute fixes the data in one path is contained in another
SYNOPSIS
#-------------------------------------------------------------------# Compare single values# foo => 42 , bar => 42 => in(foo,bar) -> trueif in(foo,bar)add_field(forty_two,ok)end# When comparing single values to an array: test if the value is# contained in the array# foo => 1 , bar => [3,2,1] => in(foo,bar) -> trueif in(foo,bar)add_field(test,ok)end# foo => 42 , bar => [1,2,3] => in(foo,bar) -> falseunless in(foo,bar)add_field(test,ok)end# In the following examples we'll write in pseudo code the true/false# values of some 'in()' comparissons# scalars vs arrays - check if the value is in the arrayfoo: 42 , bar: [1,2,3] in(foo,bar) -> falsefoo: 1 , bar: [1,2,3] in(foo,bar) -> true# scalars vs hashes - check if the key is in the hashfoo: name , bar: { name => 'Patrick' } in(foo,bar) -> truefoo: name , bar: { deep => {name => 'Nicolas'}} in(foo,bar) -> false# array vs array - check if the contents is equalfoo: [1,2] , bar: [1,2] in(foo,bar) -> truefoo: [1,2] , bar: [1,2,3] in(foo,bar) -> falsefoo: [1,2] , bar: [[1,2],3] in(foo,bar) -> false
STATUS
Be aware this function is experimental in many perl versions
SEE ALSO
Catmandu::Fix