[27378] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 9062 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 17 14:05:50 2006

Date: Fri, 17 Mar 2006 11:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 17 Mar 2006     Volume: 10 Number: 9062

Today's topics:
        deferred module loading ? <bugbear@trim_papermule.co.uk_trim>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 17 Mar 2006 17:42:35 +0000
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: deferred module loading ?
Message-Id: <441af50c$0$70299$ed2619ec@ptn-nntp-reader03.plus.net>

I am attempting to reduce the overheads of some perl scripts
I have; these scripts are quite small but are invoked
rather often from another process.

Some of the (standard) modules my scripts use have
comparitively high loading overheads (i.e. "use package;"
takes a significant proportion of time.

In some cases (depending on parameters etc)
the module may not (in fact) be used
(i.e. methods called, variables accessed).

So;

Is there any way to avoid loading a module
until it is (in fact) needed?

It appears from supercial testing
(and little understanding on my part)
that

sub method_needs_package {
    eval "use package";
}

does the load, but I am concerned at the overhead
of eval. If the method were called repeatedly this
cure may be worse than the disease.

And, yes, I have searched the documentation and the web
but haven't found information that I can use. I do not
know wether this reflects a lack of information, or a lack
of understanding on my part :-|

    BugBear


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 9062
***************************************


home help back first fref pref prev next nref lref last post