Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Selfloader - testimonies or potential uses?

by princepawn (Parson)
on Jun 04, 2007 at 15:44 UTC ( [id://619155]=perlquestion: print w/replies, xml ) Need Help??

princepawn has asked for the wisdom of the Perl Monks concerning the following question:

With knitted brows, I have been starting at the docs for SelfLoader for 10 minutes now. And I still cannot imagine when I would want this sort of functionality.

Basically, the module autoloads subroutines which are defined in the __DATA__ section of a module.

So, maybe someone could share a time when they found this module useful? Or could share a time when you could imagine this module to be useful.


Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality

Replies are listed 'Best First'.
Re: Selfloader - testimonies or potential uses?
by ikegami (Patriarch) on Jun 04, 2007 at 15:56 UTC

    The idea is to delay the compilation of functions until they are used. This could be useful when few of the functions are actually executed. For example, CGI uses functionality similar to SelfLoader because most of CGI's users use only a fraction of the functions it provides. The savings are magnified since CGI is used in an environment where it can be loaded at great frequency.

    I wonder how much benefit it provides, if any. Its effect on the method cache could be costly.

      I wonder how much benefit it provides, if any. Its effect on the method cache could be costly.

      If you're in an environment where startup time is the largest component of the work, SelfLoader might be an advantage. (In terms of CGI programming, it's very difficult for me to believe that even loading and compiling all of CGI.pm would take more time than performing network IO, but with short-lived processes, the method cache misses wouldn't be as painful.)

Re: Selfloader - testimonies or potential uses?
by princepawn (Parson) on Jun 04, 2007 at 17:06 UTC
    oh, something else to add to my list of lazy loaders


    Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2026-01-19 19:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (124 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.