Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Is require still required?

by davido (Cardinal)
on Feb 01, 2024 at 00:07 UTC ( [id://11157426]=note: print w/replies, xml ) Need Help??


in reply to Is require still required?

I can think of a lot of examples of where a module should be required, at runtime, rather than used at compiletime. Factory method patterns, providing implementation of functionality into code based on some logic, only needing to load a module if a specific condition is met, dependency injection, and so on. And there are times that filenames versus bareword module names are useful. If you search CPAN for the word 'require' you'll find a ton of use cases you probably haven't considered, and while many of them don't HAVE to be coded the way they were, many of them used require because it was the appropriate tool for the job.


Dave

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11157426]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2025-12-12 16:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (92 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.