It works and is fairly elegant. :)
Both are susceptible to someone using a class name that clobbers an existing namespace if the inputs are not trustworthy (or otherwise inept). I suppose that the eval version would allow for some sort of code injection beyond namespace collisions too, so again, the caveat about trustworthy, reliable inputs. In a real-world solution either one of our strategies should do thorough sanitization first.
Dave
In reply to Re^3: Building Perl classes dynamically based on an input schema/template
by davido
in thread Building Perl classes dynamically based on an input schema/template
by tito80
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |