Sah/SchemaR/code_from_str.pm

filter: Statementstmt 100% 8 / 8 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 100% 8 / 8 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« Sah/SchemaBundle/Code.pm ↑ Summary
1 ## no critic: TestingAndDebugging::RequireStrict
2 package Sah::SchemaR::code_from_str;
3  
4 1 our $DATE = '2024-06-10'; # DATE
5 1 our $VERSION = '0.004'; # VERSION
6  
7 1 our $rschema = do{my$var={base=>"code",clsets_after_base=>[{description=>"\nThis schema accepts coderef or string which will be eval'ed to coderef. Note\nthat this means allowing your user to provide arbitrary Perl code for you to\nexecute! Make sure first and foremost that security-wise this is acceptable in\nyour case.\n\nBy default `eval()` is performed in the `main` namespace and without stricture\nor warnings. See the parameterized version <pm:Sah::PSchema::code_from_str> if\nyou want to customize the `eval()`.\n\nWhat's the difference between this schema and `str_or_code` (from\n<pm:Sah::Schemas::Str>)? Both this schema and `str_or_code` accept string, but\nthis schema will directly compile any input string while `str_or_code` will only\nconvert string to code if it is in the form of `sub { ... }`. In other words,\nthis schema will always produce coderef, while `str_or_code` can produce strings\nalso.\n\n",examples=>[],prefilters=>[["Code::eval",{}]],summary=>"Coderef from eval\\`ed string"}],clsets_after_type=>['$var->{clsets_after_base}[0]'],"clsets_after_type.alt.merge.merged"=>['$var->{clsets_after_base}[0]'],resolve_path=>["code"],type=>"code",v=>2};$var->{clsets_after_type}[0]=$var->{clsets_after_base}[0];$var->{"clsets_after_type.alt.merge.merged"}[0]=$var->{clsets_after_base}[0];$var};
8  
9 1 1;
10 # ABSTRACT: Coderef from eval\`ed string
11  
12 __END__
« Sah/SchemaBundle/Code.pm ↑ Summary