[Israel.pm] use and require
owner at semuel.co.il
Sun Mar 20 03:40:28 PDT 2011
On complex system as such as I saw at my last job, implicit loading
caused to bizarre implicit dependencies, which the maintaining
programmer had no clue what they were and had to ask the international
framework gurus, which not always had an answer.
deferring load can cause the same mass. if you load some module only on
certain cases, be sure that it won't be there when it is needed. if you
really want to defer loading, load by 'use' some part of it,
(my::module::installed) to make sure that it exists.
then doing 'require my::module' might work. most of the time.
On 2011/03/20 18:33, David Baird wrote:
> On more complex systems, deferring loading the other file when the
> class is needed can potentially cut down on the number of modules that
> need to be compiled. I've seen complex frameworks where only 10% to
> 20% of the modules compiled are actually utilized by a given script.
> On Sun, Mar 20, 2011 at 11:02 AM, Shmuel Fomberg<owner at semuel.co.il> wrote:
>> Hi David.
>> what good will it do, if the class is defined in other file?
>> On 2011/03/20 16:54, David Baird wrote:
>>> IMHO, a nice change to Perl would be to defer loading class modules
>>> until the first Class::Module->new() statement is encountered, and at
>>> that point, Perl would "require" but not "import" the module. This is
>>> sufficient for most class modules, and would save time on initial
>>> loading of a script.
>>> On Sun, Mar 20, 2011 at 8:48 AM, Gabor Szabo<szabgab at gmail.com> wrote:
>>>> I think it totally depends on the usage pattern. For a persistent web
>>>> application loading everything up front won't hurt performance.
>>>> For an editor where people want to start typing ASAP and don't
>>>> want to wait for all the subsystems to load you will serve them better
>>>> by delaying everything as much as possible.
>>> Perl mailing list
>>> Perl at perl.org.il
>> Perl mailing list
>> Perl at perl.org.il
> Perl mailing list
> Perl at perl.org.il
More information about the Perl