goofball
09-09-2003, 12:58 PM
When require is used in Perl to import a .pl file's variables at run time, is there an effect on a process' memory aside from what the imported vars take up?
Say I want to require 'data.pl';
that contains only this:
#!/usr/bin/perl
%data = (
key_one => '1',
key_two => '2',
etcetera => '...'
);
1;
I then write more data to that file, and then
require it again to re-import it's %data hash that contains the new data. (In know I have to delete the filepath from %INC before I can require that file a second time). I know that each time I require the file, %data gets replaced so there is no problem with memory there.
But what I want to know is, does the require function import the actual code of the data.pl file (including the camas, etc.) as if the code were being compiled into the running app? I'm not sure how that works, and I don't want to risk maxing out a process' memory by re-requiring files a million times.
Thanks for any help!
Say I want to require 'data.pl';
that contains only this:
#!/usr/bin/perl
%data = (
key_one => '1',
key_two => '2',
etcetera => '...'
);
1;
I then write more data to that file, and then
require it again to re-import it's %data hash that contains the new data. (In know I have to delete the filepath from %INC before I can require that file a second time). I know that each time I require the file, %data gets replaced so there is no problem with memory there.
But what I want to know is, does the require function import the actual code of the data.pl file (including the camas, etc.) as if the code were being compiled into the running app? I'm not sure how that works, and I don't want to risk maxing out a process' memory by re-requiring files a million times.
Thanks for any help!