Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 01330ec25d
Fetching contributors…

Cannot retrieve contributors at this time

136 lines (123 sloc) 5.27 kB
__NAME__ purpose
specify directory containing code that can be included in the running installation when needed
__END__
__NAME__ synopsis
<arg choice='plain'><replaceable>directory_name</replaceable></arg>
__END__
__NAME__ description
There is a huge base of &IC; code (collection of &conf-UserTag;s and
&conf-CodeDef;s) included in the default installation.
Much of it is not needed for the usual installations,
causing a larger process memory profile than necessary.
</para><para>
Furthermore, it is hard to manually determine what subset of code is required,
especially when an &glos-ITL; tag calls
<code>$Tag-&gt;<replaceable>TAGNAME</replaceable>()</code>
which calls some filter which calls some sort of an action &mdash;
you get the idea.
</para><para>
&conf-__FILENAME__; allows building catalogs with a more optimal
set of code than just "everything".
</para><para>
&conf-CodeRepository; depends on a related directive, &conf-AccumulateCode;.
If &conf-AccumulateCode; is disabled, operation is traditional and everything
gets loaded at &IC; startup time. (There have
been some code initialization changes and routine calling changes,
but the data structures are identical and no difference in operation
should be seen).
</para><para>
It's when you remove the
<filename class='directory'>&glos-ICROOT;/code/</filename> directory and
enable &conf-AccumulateCode; that things get interesting.
&IC; starts looking into &conf-CodeRepository; for pieces it finds
missing (&glos-ITL; tags, &glos-ActionMap;s, &glos-filter;s, widgets, etc.)
and compiles these as needed, in runtime!
The code is sent to the master process for compilation and
incorporation, so that on the next page access (or in the worst case,
after &conf-HouseKeeping; seconds), &IC; will find the code already compiled
and ready to go.
</para><para>
Fetched code blocks are copied to
<filename class='directory'><varname>$Global::TagDir</varname>/Accumulated/</filename>.
When you restart &IC; the next time, these code blocks will be found,
read normally and need not be recompiled and loaded on the fly again.
</para><para>
Over time, as you access pages and routines, a full set of tags
will be developed and you can then disable &conf-AccumulateCode;.
(In fact, &conf-AccumulateCode; is recommended only for development and should
really be turned off in production systems).
__END__
__NAME__ notes
There can be failures due to calling <code>$Tag-&gt;<replaceable>TAGNAME</replaceable>()</code> from within
embedded
&PERL; for the first time, particularly when it uses a "MapRoutine" or
calls another <code>$Tag-&gt;<replaceable>TAGNAME</replaceable>()</code> within. This is due to
<classname>Safe</classname>, and there is probably
not much to be done about it. The good news is that the error should
go away after &conf-HouseKeeping; seconds, when the tag gets compiled by the
master.
&tag-area;, &tag-tmp;, &tag-tmpn;, and &tag-image; are examples of tags known
to fail in this manner.
Tags that are frequently called
in this fashion should probably be manually placed in directory
<filename class='directory'>code/Vital/</filename> and not
be accumulated "by chance".
Anyway, this temporary failure could be avoided by listing &glos-catalog; in the
&conf-AllowGlobal; directive, and it
might also be possible to make a directive that allows &conf-AllowGlobal; for
a catalog automatically, when in &conf-AccumulateCode; mode.
(If you don't want to trade immediate code loading for the lack of
&conf-AllowGlobal; protection, then just set &conf-HouseKeeping; to
something like <literal>20 seconds</literal> &mdash; and
only do it on your development system!)
</para><para>
One convenient side-effect is that you can easily load new code (such as new
&IC; tags) "on the fly" by simply adding files to the &conf-CodeRepository;
directory. This alleviates the need for &IC; server restart.
It might also be possible to dynamically <emphasis role='bold'>remove and
load</emphasis> code from the server in this manner, but this has yet
to be looked at.
</para>
<warning>
<para>
Nice features are often dangerous! Don't run this in
production &mdash; you have been warned!
</para><para>
"OrderCheck" &conf-CodeDef; is not yet implemented, and a full audit has
not been done on all compiled code directives.
</para><para>
Not fully tested in &conf-PreFork; mode, and really not intended for
that mode.
</para><para>
Defining multiple tags or code blocks (&conf-UserTag;s or &conf-CodeDef;s)
within a single file may result in an unpredictable behavior.
</para><para>
This feature only applies to global code &mdash; catalog-based code
is not affected and behaves as usual.
</para>
</warning>
<para>
__END__
__NAME__ see also
AccumulateCode
__END__
__NAME__ author
&mheins;
__END__
__NAME__ example: Setting up CodeRepository
Put the following in &gcf;:
<programlisting>
AccumulateCode Yes
CodeRepository /usr/interchange/code.pool/
</programlisting>
To prepare the <filename class='directory'>code.pool/</filename>
directory, you can do something like this:
<programlisting>
$ mkdir /usr/interchange/code.pool/
$ mv /usr/interchange/code/* /usr/interchange/code.pool/
</programlisting>
__END__
__NAME__ missing
Hot-link MapRoutine word
provide link to example pricing.txt
__END__
Jump to Line
Something went wrong with that request. Please try again.