|> Home > Documentation > Latest documentation > Global config directives > FileControl|
Control access to files using rules coded into a custom Perl subroutine.
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.
This directive allows you to control access to your files with the use of a block of custom Perl code. Your Perl subroutine can grant or deny access to requested files using whatever criteria you need.
The custom subroutine will be called with three parameters, as follows:
The return value is expected to be a boolean. A true return value will be taken to mean that access to the requested file should be granted, whereas a false return value will result in the file access request being denied.
Specifying a FileControl subroutine inline
Specifying a FileControl subroutine as a Sub or GlobalSub
Mapping FileControl to a subroutine in a Perl module
Assuming you have a Perl module called YourModule, and that module contains an appropriately-coded file_control() subroutine, you may make use of the subroutine as follows: