Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

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]
[marinersk]: Corion This DBA wants to smack others who like putting whitespace in column names.
[marinersk]: s/smack/whap/;
[talexb]: Wow, what hilariously bad form.
[SuicideJunkie]: Just wait; someday soon, you'll be given a DB with unicode emojis in the column names.
[Corion]: marinersk: Well, I have done select statements like select sum(foo) as "Total Amount", ..., but to have a table like that makes me shudder
[Corion]: SuicideJunkie: :-D
[marinersk]: SuicideJunkie LOL
[choroba]: Woohoo! Fixed a test that hasn't run for 3 years.
[marinersk]: Corion Yes, sometimes whitespace in column headers is acceptable, but I still consider it be less than desireable if that query might get revectored for an ETL-esque process...
[marinersk]: choroba++

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (11)
As of 2017-05-25 15:03 GMT
Find Nodes?
    Voting Booth?