[system] / trunk / pg / macros / dangerousMacros.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/dangerousMacros.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 2149 Revision 2150
106 $templateDirectory, 106 $templateDirectory,
107 $scriptDirectory, 107 $scriptDirectory,
108 $externalTTHPath, 108 $externalTTHPath,
109 ); 109 );
110 110
111sub _dangerousMacros_init { #FIXME use local envir instead of local variables? 111sub _dangerousMacros_init { #use %envir instead of variables such as $macroDirectory -- not sure why -- perhaps variables haven't been unpacked yet.
112 $macroDirectory = eval('$main::macroDirectory') ; 112 $macroDirectory = eval('$main::envir{macroDirectory}') ;
113 $courseScriptsDirectory = eval('$main::courseScriptsDirectory'); 113 $courseScriptsDirectory = eval('$main::envir{courseScriptsDirectory}');
114 $templateDirectory = eval('$main::templateDirectory'); 114 $templateDirectory = eval('$main::envir{templateDirectory}');
115 $scriptDirectory = eval('$main::scriptDirectory'); 115 $scriptDirectory = eval('$main::envir{scriptDirectory}');
116 $externalTTHPath = eval('$envir{externalTTHPath}'); 116 $externalTTHPath = eval('$main::envir{externalTTHPath}');
117 warn "dangerousmacros initialized" if $debugON; 117 warn "dangerousmacros initialized" if $debugON;
118 warn eval(q! "dangerousmacros.pl externalTTHPath is ".$main::externalTTHPath;!) if $debugON; 118 warn eval(q! "dangerousmacros.pl externalTTHPath is ".$main::externalTTHPath;!) if $debugON;
119 warn eval(q! "dangerousmacros.pl: The envir variable $main::{envir} is".join(" ",%main::envir)!) if $debugON; 119 warn eval(q! "dangerousmacros.pl: The envir variable $main::{envir} is".join(" ",%main::envir)!) if $debugON;
120} 120}
121 121
191 eval {main::time_it("begin load macros");}; 191 eval {main::time_it("begin load macros");};
192 ############################################################################### 192 ###############################################################################
193 # At this point the directories have been defined from %envir and we can define 193 # At this point the directories have been defined from %envir and we can define
194 # the directories for this file 194 # the directories for this file
195 ############################################################################### 195 ###############################################################################
196 196
197 # special case inits 197 # special case inits
198 foreach my $file ('PG.pl','dangerousMacros.pl','IO.pl') { 198 foreach my $file ('PG.pl','dangerousMacros.pl','IO.pl') {
199 my $macro_file_name = $file; 199 my $macro_file_name = $file;
200 $macro_file_name =~s/\.pl//; # trim off the extension 200 $macro_file_name =~s/\.pl//; # trim off the extension
201 $macro_file_name =~s/\.pg//; # sometimes the extension is .pg (e.g. CAPA files) 201 $macro_file_name =~s/\.pg//; # sometimes the extension is .pg (e.g. CAPA files)
254 # macros are searched for first in the $macroDirectory of the course 254 # macros are searched for first in the $macroDirectory of the course
255 # and then in the webwork $courseScripts directory. 255 # and then in the webwork $courseScripts directory.
256 256
257 my $macro_file_loaded = defined($init_subroutine) && defined(&$init_subroutine); 257 my $macro_file_loaded = defined($init_subroutine) && defined(&$init_subroutine);
258 warn "dangerousMacros: macro init $init_subroutine_name defined |$init_subroutine| |$macro_file_loaded|" if $debugON; 258 warn "dangerousMacros: macro init $init_subroutine_name defined |$init_subroutine| |$macro_file_loaded|" if $debugON;
259
260 unless ($macro_file_loaded) { 259 unless ($macro_file_loaded) {
261 #print STDERR "loadMacros: loading macro file $fileName\n"; 260 #print STDERR "loadMacros: loading macro file $fileName\n";
262 if (-r "$macroDirectory$fileName") { 261 if (-r "$macroDirectory$fileName") {
263 compile_file("$macroDirectory$fileName"); 262 compile_file("$macroDirectory$fileName");
264 263

Legend:
Removed from v.2149  
changed lines
  Added in v.2150

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9