On 11/30/2011 12:42 PM, Zefram wrote:
> demerphq wrote:
>> But it would be nice if there was an easy way to tell Perl and Module
>> code to preload everything and forget lazy loading.
>
> use less "laziness";
>
> If we standardise on this less.pm keyword meaning that, then any module
> can participate in observing it. A module's ->import method would want
> to look for the less-laziness flag in its caller's hint hash.
>
> Unfortunately, the less->of method doesn't actually look there: it
> only looks at its immediate caller's hint hash. less->of("laziness")
> will actually only return true when called within the lexical scope of
> 'use less "laziness";'. We need a better interface for querying it.
> Then we can actually make less.pm useful.
>
> -zefram
Adam Kennedy wrote prefork for this. Clearly, it's opt-in and few
authors choose to add a dependency for this niche use case.
http://search.cpan.org/dist/prefork/lib/prefork.pm
If this or something like it was in the core, there might be a better
chance of seeing it used. Of course only if the author is willing to
accept requiring the module or a version of perl >= X.
Cheers,
Steffen
Thread Previous
|
Thread Next