in reply to Re^2: Building Perl classes dynamically based on an input schema/template
in thread Building Perl classes dynamically based on an input schema/template

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

  • Comment on Re^3: Building Perl classes dynamically based on an input schema/template

Replies are listed 'Best First'.
Re^4: Building Perl classes dynamically based on an input schema/template
by tito80 (Novice) on Nov 16, 2016 at 20:29 UTC
    Karl and Dave, Thanks to both of you for your great inputs. I was initially looking for an usage example with CLASS::MOP to solve the problem, but I guess now that it can be solved through the above methods equally well. Let me look into implementing them and update you if I run into any issues. Thanks, Tito
Re^4: Building Perl classes dynamically based on an input schema/template
by karlgoethebier (Abbot) on Nov 16, 2016 at 11:35 UTC

    Thanks for the feedback. Regards, Karl

    «The Crux of the Biscuit is the Apostrophe»