From: Michael G. <ga...@ma...> - 2005-05-04 13:42:13
|
On May 3, 2005, at 9:23 PM, Davide P.Cervone wrote: > Folks: > > On the discussion board at > > http://webhost.math.rochester.edu/webworkdocs/discuss/msgReader$3244? > mode=topic&y=2005&m=4&d=22 > > a user asks how to add directories that can be searched for macro > files by loadMacros(). The current implementation doesn't provide for > this, but it would not be hard to do. One possibility would be to add > a variable to global.conf that is an array of directories to be > searched (in the order given). In dangerousMacros around line 260, > you would repalce the explicit check of $macroDirectory and > $courseScriptsDirectory by a loop through the macro directory array. > (The macroDirectory and courseScriptsDirectory variables can then be > dropped.) > This sounds like an excellent idea. To expand on it I think something similar will need to be done for the "alias" subroutine -- give it a list of places to find images, applets and so forth. The alias subroutine is a bit of a mess -- it hasn't been looked at in quite a long time. > I would also like to suggest that loadMacros be able to access > subdirectories of the macro directory (not by searching them > automatically, but by making explicit references to them). For > example, there are several macro files that defined various Parser > contents, and it would be nice to have a "context" subdirectory of the > macros directory and then use > > loadMacros("context/LimitedVector.pl"); > We should add something like this. Would using double colons be better -- following the perl Module convention? loadMacros("context::LimitedVector.pl"); > The curernt loadMacros() will actually do this, but the _init() > routine stuff won't work for this. This can be fixed with a single > line in dangerousMacros. At around line 205, right after > > my $init_subroutine_name = "_${macro_file_name}_init"; > > you should add > > $init_subroutine_name =~ s/[^a-z0-9_]/_/gi; > > to convert any '/' to a '_' in the name. (This also converts any > other special characters to underscores, so that in case the file name > contains characters that are not legal in a perl subroutine name, they > will not cause problems with the _init() routine. This would be a > good thing to do even if you don't like the sub-directory idea.) > > What do you think? > Both ideas seem good to me. What do you think of the double colon idea? Do you think the slash is more straightforward? Take care, Mike > Davide > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: NEC IT Guy Games. > Get your fingers limbered up and give it your best shot. 4 great > events, 4 > opportunities to win big! Highest score wins.NEC IT Guy Games. Play to > win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 > _______________________________________________ > OpenWeBWorK-Devel mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/openwebwork-devel > |