in reply to Re: Re: Using a paramter value to call a module
in thread Using a paramter value to call a module

Interesting solution, but could you please explain the eval statement in the require_if_present sub? It looks as if you are using a here document, but would a try-catch-block eval not be more appropriate here?

TMTOWTDI: That just happens to be the way I implemented it. A here document is convenient for some of the other things I do this way, but that is not a good reason to use it here. Using an eval as you suggest sounds like a cleaner approach. But against that this works (I have used it many times in the last year) and I try not to fix things that work.

Update: Thinking about this last night I realised why I used a here document to do an eval, its because this was a very common construct in Perl 4 (now that is a really bad reason for doing it here).

  • Comment on Re: Re: Re: Using a paramter value to call a module