… | |
… | |
32 | |
32 | |
33 | return if $$ != $PID; # do not do this in child processes |
33 | return if $$ != $PID; # do not do this in child processes |
34 | |
34 | |
35 | if (cf::in_main && !cf::tick_inhibit) { |
35 | if (cf::in_main && !cf::tick_inhibit) { |
36 | Carp::cluck "ERROR: attempted synchronous perl module load ($mod)"; |
36 | Carp::cluck "ERROR: attempted synchronous perl module load ($mod)"; |
|
|
37 | return; # do it blockingly |
37 | } else { |
38 | } else { |
38 | cf::debug "loading perl module $mod\n"; |
39 | cf::debug "loading perl module $mod\n"; |
39 | } |
40 | } |
40 | |
41 | |
41 | # find real file |
42 | # find real file |
… | |
… | |
101 | } |
102 | } |
102 | |
103 | |
103 | () |
104 | () |
104 | } |
105 | } |
105 | |
106 | |
|
|
107 | sub preload_stuff { |
|
|
108 | # load some stuff so perl doesn't load it later... :/ |
|
|
109 | |
|
|
110 | eval { &Storable::nstore_fd }; |
|
|
111 | |
|
|
112 | require 'utf8_heavy.pl'; |
|
|
113 | require 'unicore/PVA.pl'; |
|
|
114 | require 'unicore/To/Fold.pl'; |
|
|
115 | require 'unicore/To/Digit.pl'; |
|
|
116 | require 'unicore/To/Lower.pl'; |
|
|
117 | require 'unicore/To/Upper.pl'; |
|
|
118 | require 'unicore/To/Title.pl'; |
|
|
119 | #TODO# load whole unicore, really. |
|
|
120 | } |
|
|
121 | |
106 | sub init { |
122 | sub init { |
107 | # save original @INC |
123 | # save original @INC |
108 | @cf::ORIG_INC = ($cf::LIBDIR, @INC) unless @cf::ORIG_INC; |
124 | @cf::ORIG_INC = ($cf::LIBDIR, @INC) unless @cf::ORIG_INC; |
109 | |
125 | |
110 | # make sure we can do scalar-opens |
126 | # make sure we can do scalar-opens |
111 | open my $dummy, "<", \my $dummy2; |
127 | open my $dummy, "<", \my $dummy2; |
112 | |
128 | |
113 | # execute some stuff so perl load's some of the core modules |
129 | preload_stuff; |
114 | /Ü/ =~ /ü/i; |
|
|
115 | eval { &Storable::nstore_fd }; |
|
|
116 | |
130 | |
117 | @INC = (\&inc_loader, @cf::ORIG_INC); # @ORIG_INC is needed for DynaLoader, AutoLoad etc. |
131 | @INC = (\&inc_loader, @cf::ORIG_INC); # @ORIG_INC is needed for DynaLoader, AutoLoad etc. |
118 | |
132 | |
119 | cf::debug "module loading will be asynchronous from this point on."; |
133 | cf::debug "module loading will be asynchronous from this point on."; |
120 | } |
134 | } |