in reply to Module Efficiency

I include them as needed, and I never seem to have problems.

I read this as require 'myscript.pl';
It's a small but important step to change this to use myscript, IMHO, as it clarifies the meaning and just makes your actual used-as-a-module script a real perl-module (following the tips and links given to you already).

If I misread this, and including means cut & paste, let not speed, memory, efficiency of the code and such be your first concern, but maintainabilty: turn your code into a module / modules for the sanity of those following you or accompaning you in your coding projects, again by following the tips and links given to you allready.

kind regards,
tomte


Hlade's Law:

If you have a difficult task, give it to a lazy person --
they will find an easier way to do it.

Replies are listed 'Best First'.
Re: Re: Module Efficiency
by Coplan (Pilgrim) on Apr 11, 2003 at 13:26 UTC
    Your assumption was right. I don't copy/paste, as that gets annoying for me. What I'll do is stick a copy of the "common.pl" script (as I call it), and then I'll include/require it at the beginning of my program.

    I do this mostly with web interfaces that I do. A lot of the scripts are generic SQL queries, cookies, forms, and so on. Honestly, they could easily be placed into a module.

    As Ovid pointed out, and I agree, it would be best to make sure the script works perfectly first. The script that I'm currently working on is smooth, and very usable. I'm right now in the process of optimizing my code, and cleaning it up a bit. My reason for asking my initial question was to see if I could improve speed and (more importantly) memory usage with the script.

    All your feedback is great. I'm gaining new perspective. Thanks all!

    --Coplan