Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re^2: Small examples of string eval

by stvn (Monsignor)
on May 13, 2006 at 15:12 UTC ( #549240=note: print w/replies, xml ) Need Help??

in reply to Re: Small examples of string eval
in thread Small examples of string eval

He (TheDamian) further advises you to use anonymous subroutines and the CPAN Sub::Installer module when you have a need to create new subroutines that are built around some expression that the user supplies.

While Sub::Installer is certainly a good idea (insulating the user from the evils of symbol table manipulation, which is at least as dangerous as string eval in the 'wrong' hands). It's code can hardly be considered to contain "Best Practices" IMO. It clearly abuses UNIVERSAL in a way which affects not only the code which uses it, but all other running Perl code. This is the offending code:

package UNIVERSAL; use base 'Sub::Installer';
This would mean that every Perl object will respond true to the query $object->isa('Sub::Installer'). Again, IMO, that is not a Best Practice, but instead a really really bad idea.

Sorry, I am a little passionate about code which tramples over the Perl 5 object model like this.

But fear not! CPAN will save the day. As an alternative, I offer Sub::Install an excellent module which does not assert it's will upon your entire runtime.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://549240]
Jar. Jar!...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2017-03-28 03:10 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (326 votes). Check out past polls.