Require
Refuse to (re)start the website (or Interchange itself)
if a named facility is not present.
Synopsis
|
Require type name [[path] "message"]
|
Scope
This directive is available for use globally
(in the "interchange.cfg" configuration file),
and locally (in the "catalog.cfg" configuration file).
The global configuration affects all websites running
under the Interchange instance.
Each individual website's local configuration will not affect
or influence other websites in any way.
Description
When used locally (in the "catalog.cfg" file),
this directive requires that the named facility be present before
the individual website will start or reconfigure.
When used globally (in the "interchange.cfg" file),
the lack of a required facility will cause the entire Interchange
instance to refuse to start.
If a message parameter is specified then that will be displayed to
provide a (hopefully) helpful reminder.
This is useful when transporting websites to another server,
ensuring that they have all of the facilities they require.
If the third parameter (path) is a directory name,
and "type" is set to "module",
then the specified directory will be added to the Perl search
path (@INC).
Facility types
The following facility types can be checked for and required:
| Type
|
Descrption
|
Versions
|
| executable
|
Check that a file exists and is executable by the user ID that
started the current Interchange instance.
If specified in a global (interchange.cfg)
configuration file then any file on the filesystem may be checked.
If specified in a local (catalog.cfg) configuration
file then only files relative to the website's home directory,
as configured using the Catalog global
configuration directive,
may be checked. |
5.5.0+
|
| file
|
Check that a file exists and is readable by the user ID that
started the current Interchange instance.
If specified in a global (interchange.cfg)
configuration file then any file on the filesystem may be checked.
If specified in a local (catalog.cfg) configuration
file then only files relative to the website's home directory,
as configured using the Catalog global
configuration directive,
may be checked. |
5.5.0+
|
| globalsub
|
Check that the named GlobalSub exists. |
All
|
| include
|
The name parameter will be taken to be a directory name.
If the directory exists then it will be added to Perl's @INC
path.
If the named directory does not exists then this test will fail. |
All
|
| module
|
Check that the named Perl module exists within Perl's @INC path.
If a "path" parameter is specified then it will be added to
Perl's @INC path prior to the test. |
All
|
| sub
|
Check that the named Sub exists. |
All
|
| taggroup
|
Check that the named TagGroup exists. |
All
|
| usertag
|
Check that the named UserTag exists.
If specified in a local (catalog.cfg) configuration
file then the named UserTag will be checked
for in both the local and </i>global</i> namespaces,
otherwise only the global namespace will be checked. |
All
|
|
Availability
"All versions" refers to Interchange 5.0.0 and above,
as 5.0.0 is the baseline for the documentation on
this website.
Most of the facility types marked "All" were available long before
version 5.0.0 was released.
|
Examples
Plain usage, with no frills
Require usertag email
Require globalsub form_mail
Require module Digest::MD5
|
Require a UserTag and show reminder text if not found
Require module Digest::MD5 "Need %s %s for better cache keys."
Require module Safe::Hole "Need %s %s for embedded perl object access."
|
Append to the search path while loading a module
|
Require module Vend::Swish /usr/local/lib/swish-e/perl
|
See also