Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 94 lines (79 sloc) 3.235 kb
656e8f1 @docelic Phew, a large commit; glossary/ITL took me 4 hours.
docelic authored
1 __NAME__ purpose
2 add a new configuration directive
3 __END__
4
5 __NAME__ synopsis
eaf1a62 @docelic Went over a few of the configuration directives:
docelic authored
6 <arg choice='plain'><replaceable>directive_name</replaceable></arg>
a7b2ca3 @docelic * Updates/corrections to A* config directives
docelic authored
7 <arg><replaceable>parse_function_name</replaceable>
8 <arg><replaceable>default_value</replaceable></arg></arg>
656e8f1 @docelic Phew, a large commit; glossary/ITL took me 4 hours.
docelic authored
9 __END__
10
11
12 __NAME__ description
eaf1a62 @docelic Went over a few of the configuration directives:
docelic authored
13 This directive allows you to extend the set of regular
14 &glos-configuration;
f4b2f5b @docelic docbook/literals.ent: Added entity &GE; - "glossary entry"
docelic authored
15 directives accepted in each &ccf;. The added
e96ebe8 @docelic Overall improvements in language style and one addition to examples.
docelic authored
16 directives are then treated the same as the existing "built-ins".
656e8f1 @docelic Phew, a large commit; glossary/ITL took me 4 hours.
docelic authored
17 </para><para>
f4b2f5b @docelic docbook/literals.ent: Added entity &GE; - "glossary entry"
docelic authored
18 Three standard arguments can be specified: the
eaf1a62 @docelic Went over a few of the configuration directives:
docelic authored
19 <literal>directive_name</literal>,
20 <literal>parse_function_name</literal> and
21 <literal>default_value</literal>.
656e8f1 @docelic Phew, a large commit; glossary/ITL took me 4 hours.
docelic authored
22 </para><para>
a7b2ca3 @docelic * Updates/corrections to A* config directives
docelic authored
23 If the parse function is not defined (either by omitting it or
e96ebe8 @docelic Overall improvements in language style and one addition to examples.
docelic authored
24 literally specifying <literal>undef</literal>), then no parser
eaf1a62 @docelic Went over a few of the configuration directives:
docelic authored
25 will be called on the value at all,
656e8f1 @docelic Phew, a large commit; glossary/ITL took me 4 hours.
docelic authored
26 and the value of the directive will be exactly what users specify in their
eaf1a62 @docelic Went over a few of the configuration directives:
docelic authored
27 config files (which will usually be &PERL; scalar values). If the parser
e96ebe8 @docelic Overall improvements in language style and one addition to examples.
docelic authored
28 argument <emphasis>is</emphasis> supplied, then the requested parser function
29 must already be defined because it can't be referenced
30 <emphasis>in advance</emphasis>. It can be defined either as a
31 &conf-Sub; or &conf-GlobalSub; block, or can refer to an existing parser
32 function from <filename>lib/Vend/Config.pm</filename>.
eaf1a62 @docelic Went over a few of the configuration directives:
docelic authored
33 The file <filename>lib/Vend/Config.pm</filename> contains all the default
656e8f1 @docelic Phew, a large commit; glossary/ITL took me 4 hours.
docelic authored
34 parser functions, which are recognized by the mandatory prefix
e96ebe8 @docelic Overall improvements in language style and one addition to examples.
docelic authored
35 <literal>parse_</literal>. (You do not, however, include
f4b2f5b @docelic docbook/literals.ent: Added entity &GE; - "glossary entry"
docelic authored
36 <literal>parse_</literal> in the <literal>parse_function_name</literal>.)
eaf1a62 @docelic Went over a few of the configuration directives:
docelic authored
37 </para><para>
a7b2ca3 @docelic * Updates/corrections to A* config directives
docelic authored
38 The <literal>default_value</literal> is optional.
656e8f1 @docelic Phew, a large commit; glossary/ITL took me 4 hours.
docelic authored
39 </para><para>
40 Directly modifying <filename>Config.pm</filename> (or any other
a7b2ca3 @docelic * Updates/corrections to A* config directives
docelic authored
41 files from the &IC; installation) is discouraged for portability
42 reasons. Therefore, to add a custom parsing function, you should
656e8f1 @docelic Phew, a large commit; glossary/ITL took me 4 hours.
docelic authored
43 modify &gcf; as seen in <xref linkend="AddDirective_examples"/>
e96ebe8 @docelic Overall improvements in language style and one addition to examples.
docelic authored
44 (note again that the parser definition
656e8f1 @docelic Phew, a large commit; glossary/ITL took me 4 hours.
docelic authored
45 must logically come before &conf-AddDirective;).
46 __END__
47
48 __NAME__ notes
49 Note that <literal>boolean</literal>, one of the default parse functions, is
50 actually
51 a boolean list, and not a true boolean value. The list achieves the effect
52 of being boolean by logically returning &glos-true; or &glos-false;,
53 depending on whether the searched item is present in the list or not.
caf7b31 @docelic * Added docs for: DiscountSpacesOn RobotHost NotRobotUA
docelic authored
54 True boolean values are called "<literal>yesno</literal>"s in &IC; parlance.
eaf1a62 @docelic Went over a few of the configuration directives:
docelic authored
55 </para><para>
56 Please see the &glos-configuration; glossary entry for a discussion
57 on config directives.
656e8f1 @docelic Phew, a large commit; glossary/ITL took me 4 hours.
docelic authored
58 __END__
59
b9f1f29 @docelic * Collection of mostly style fixes for config directive 'purpose' lines
docelic authored
60 __NAME__ example: Adding a new catalog configuration directive with a custom parse routine
656e8f1 @docelic Phew, a large commit; glossary/ITL took me 4 hours.
docelic authored
61 Let's add the <literal>DocRoot</literal> directive. Put the following
62 in your &gcf;:
e96ebe8 @docelic Overall improvements in language style and one addition to examples.
docelic authored
63 <programlisting><![CDATA[
64 GlobalSub <<EOS
b9f1f29 @docelic * Collection of mostly style fixes for config directive 'purpose' lines
docelic authored
65 sub declare_extra_config {
e96ebe8 @docelic Overall improvements in language style and one addition to examples.
docelic authored
66
b9f1f29 @docelic * Collection of mostly style fixes for config directive 'purpose' lines
docelic authored
67 package Vend::Config;
e96ebe8 @docelic Overall improvements in language style and one addition to examples.
docelic authored
68
b9f1f29 @docelic * Collection of mostly style fixes for config directive 'purpose' lines
docelic authored
69 sub parse_docroot {
70 my ($var, $value) = @_;
71
72 unless ( -d $value ) { $@ = errmsg("Directory $value: $!") }
73 if ($@) { config_warn($@) }
74
75 return;
76 }
e96ebe8 @docelic Overall improvements in language style and one addition to examples.
docelic authored
77 }
78 EOS
79
eaf1a62 @docelic Went over a few of the configuration directives:
docelic authored
80 AddDirective DocRoot docroot "/var/www"
e96ebe8 @docelic Overall improvements in language style and one addition to examples.
docelic authored
81 ]]></programlisting>
656e8f1 @docelic Phew, a large commit; glossary/ITL took me 4 hours.
docelic authored
82 __END__
83
b9f1f29 @docelic * Collection of mostly style fixes for config directive 'purpose' lines
docelic authored
84 __NAME__ example: Adding the "Swish" directive with an existing parse routine
5b12ef3 @racke added example: Enabling Swish search
racke authored
85 <programlisting>
e96ebe8 @docelic Overall improvements in language style and one addition to examples.
docelic authored
86 Require module Vend::Swish
eaf1a62 @docelic Went over a few of the configuration directives:
docelic authored
87
e96ebe8 @docelic Overall improvements in language style and one addition to examples.
docelic authored
88 Variable swish Vend::Swish
eaf1a62 @docelic Went over a few of the configuration directives:
docelic authored
89
e96ebe8 @docelic Overall improvements in language style and one addition to examples.
docelic authored
90 AddDirective Swish hash
5b12ef3 @racke added example: Enabling Swish search
racke authored
91 </programlisting>
92 __END__
eaf1a62 @docelic Went over a few of the configuration directives:
docelic authored
93
Something went wrong with that request. Please try again.