On Thu, Apr 13, 2000 at 08:37:28AM -0400, Ricky Morse wrote: > Hi! I have another question.... > > I am working on a .cgi that I am trying to make extensible. It is a very > complex .cgi, and I would like to be able to split it across many files. > There are two things I would like to do for this: > > 1) Is there some equivalent of C's "include"? "use" says that it must > take a bareword -- ie, it looks for something in @INC. I would like to > be able to reference code in files that are in the same directory as the > .cgi, or some subdirectory thereof. @INC generally includes the current directory at the end. You can add the current directory explicitly with: use lib '.'; which will add the current directory to the beginning of @INC. > 2) I have a hash in the main program which matches command actions with > the functions that work on them. That is, I have the following code: > > $approved_subs{'create_form'} = \&create_form; > $approved_subs{'edit_prefs'} = \&edit_prefs; > > Is there some way that I can do the following (not written in perl) > > include "preferences.pl"; > > # in preferences.pl: > $approved_subs{'my_prefs'} = \&my_prefs; > ... You probably want do or require here, rather than use: do "preferences.pl"; # or require "preferences.pl"; Ronald # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org