perl5ever has asked for the wisdom of the Perl Monks concerning the following question:
Example - in this case the module Fcntl is a compile-time dependency of module Bar:
package Bar; use Smart::Comments; sub blather { ### $foo }
However, in this example, LWP::UserAgent is just a run-time dependency of module Foo:
It could also be written like this:package Foo; use LWP::UserAgent; sub make_agent { LWP::UserAgent->new }
It would then be some other code's responsibility to ensure that LWP::UserAgent was loaded before any subs in package Foo were called.package Foo; # NOTE: this module needs LWP::UserAgent loaded in order to work sub make_agent { LWP::UserAgent->new }
Specifically, a compile-time dependency is a module which needs to be loaded in order for a compile-check to work. A run-time dependency is one that only required to be loaded at run time.
So the question again - has anyone found it useful to formally declare a module's run-time only dependencies - perhaps with a pragma like:
use runtime LWP::UserAgent;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: use: distinguishing compile-time vs run-time dependencies
by chromatic (Archbishop) on Aug 08, 2011 at 00:59 UTC | |
|
Re: use: distinguishing compile-time vs run-time dependencies
by moritz (Cardinal) on Aug 08, 2011 at 01:06 UTC | |
by perl5ever (Pilgrim) on Aug 08, 2011 at 02:33 UTC | |
by perl5ever (Pilgrim) on Aug 08, 2011 at 16:31 UTC | |
|
Re: use: distinguishing compile-time vs run-time dependencies
by Khen1950fx (Canon) on Aug 08, 2011 at 01:10 UTC | |
|
Re: use: distinguishing compile-time vs run-time dependencies
by JavaFan (Canon) on Aug 08, 2011 at 10:11 UTC | |
by perl5ever (Pilgrim) on Aug 08, 2011 at 16:29 UTC | |
by JavaFan (Canon) on Aug 08, 2011 at 16:44 UTC |