Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: The 'eval "require $module; 1"' idiom

by sundialsvc4 (Abbot)
on Apr 22, 2014 at 21:10 UTC ( #1083232=note: print w/replies, xml ) Need Help??

in reply to The 'eval "require $module; 1"' idiom

I dunno, tye ... I sincerely respect your greater knowledge on this particular subject, but I certainly believe that UNIVERSAL::require has helped me out of quite-a-few tight spots.   It’s a very small bit of source-code, actually, but it sure did grease a lot of hinges.

Nevertheless, looking-over the OP’s original posting (and never-mind UNIVERSAL at this point ...), I do feel that most of these bullet-points should properly be dismissed as hypothetical ... or as “downright suspicious.”   “Suspicious,” in fact, to the degree that we should not consent to write code that is willing to accomodate them.

“Suspicious S.O.B. that I am,” I think that it is perfectly reasonable to presume that any module that we might actually wish to consent to require into our systems should be entirely free of compile-errors and should return true.   If it does not, then why-the-heck should we be willing to presume that “the source-file that we are referencing” is, in fact, the legitimate piece of source-code that we (innocently? na´vely?) expected to find?   It could just as easily be a rogue – a malicious imposter – that some Evil Entity™ didn’t quite get quite-right the first time.

The “stock” implementation of require has a few pragmatic rough-edges that can be fairly glossed-over (e.g. by UNIVERSAL ...), but we should never allow our “suspension of disbelief” to go too-far.   If any situation that we encounter crosses the boundary of healthy suspicion, we should not allow it to proceed.

  • Comment on Re: The 'eval "require $module; 1"' idiom

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1083232]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2018-02-18 05:17 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (250 votes). Check out past polls.