You can add another one of mine to this list.

* prefork by Adam Kennedy
    L<http://search.cpan.org/~adamk/prefork-0.03/lib/prefork.pm>

This is more of a meta-module for this list.

It is (ultimately) intended to provide a central point of control across all of the various module loaders, so that in normal cases you autoload, but in preforking scenarios you load early to take full advantage of copy-op-write.

Basically, I wanted the best memory use for the same code under both CGI and mod_perl.

Simple example
--------------

use prefork 'CGI';

if ( $happens_ten_percent_of_the_time ) {
        require CGI;
        print CGI->something;
}

--------------

If you run that code as a CGI, the C<use prefork> line is a null-op.

If you run if under mod_perl (or something else triggers the preforking scenario) the module is loaded in early.

And it can handle delayed preforking, you don't have to know at compile time which way to go.

Eventually I want it to support ALL of the autoloading modules, but for now is basically provides the following.

* Autodetect mod_perl and enable preforking

* preloads explicitly specified modules (the example)

* preloads any delayed Class::Autouse modules

* Extensible enough to hook your own autoloader thingies into it

Adam

Terrence Brannon wrote:
I think a list of modules which dynamically load packages and/or
create objects at runtime would be useful. Please add any modules that
you know of that I overlooked... also feel free to write a
comprehensive assessment of these modules (grin).


NAME Catalog::lazy_loaders - list of all CPAN object/package lazy loaders

DESCRIPTION
    A lazy loader allows a program to dynamically (i.e., at run-time, on
    demand) load a package. I have seen several such modules make their way
    onto CPAN and thought it would be beneficial to have a list of all of
    them somewhere.

    Ideally the features of these modules would be evaluated, but cataloging
    the modules is a valuable first step.

RELATED MODULES
    * Object::RealizeLater by Mark Overmeer
        <http://search.cpan.org/dist/Object-Realize-Later/>

    * Class::Autouse by Adam Kennedy
        <http://search.cpan.org/~adamk/Class-Autouse-1.14/>

    * AnyLoader by Michael Schwern
        <http://search.cpan.org/search?dist=anyloader>

    * Class::Loader by Vipul Ved Prakash
        <http://search.cpan.org/dist/Class-Loader/>

        Note: this module got slagged on cpan ratings:

        <http://cpanratings.perl.org/d/Class-Loader>

    * load by Elizabeth Mattijsen
        <http://search.cpan.org/dist/load>

    * Module::Load::Conditional by Jos Boumans
        <http://search.cpan.org/dist/Module-Load-Conditional>

    * Class::Dynamic by Simon Cozens
        <http://search.cpan.org/dist/Class-Dynamic>

    * require
        I suppose require in the Perl core deserves an honorable mention.

SEE ALSO
    For further discussion of this topic, please comment at the Perl
    software design mailing/GMANE list:

    <http://www.metaperl.com/sw-design>

AUTHOR
    Terrence Brannon, <[EMAIL PROTECTED]>

COPYRIGHT AND LICENSE
    Copyright (C) 2005 by Terrence Brannon

    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself, either Perl version 5.8.4 or, at
    your option, any later version of Perl 5 you may have available.



_______________________________________________ sw-design mailing list [email protected] http://metaperl.com/cgi-bin/mailman/listinfo/sw-design

Reply via email to