ExternalExport — specify Perl variables to dump to external file
The directive specifies Perl variables to dump to ExternalFile
.
On global level, using the equal sign ("=
") it is possible
to specify original Perl structure and the resulting "translated" name in the
output file. Global elements appear directly under each catalog hash in the
output file.
On catalog level, it is not possible to "translate" names, but you can use
the notation "->
" to dump specific elements from array
or hash structures. Catalog elements appear under hash key
"external_config
" under each catalog hash in the
output file.
See the section called “EXAMPLES” for clarification.
Example: Defining ExternalExport
Here's a complete example and the expected result:
In interchange.cfg
:
External yes ExternalExport Global::Catalog=number_of_catalogs ExternalFile /tmp/external
In catalog.cfg
:
External yes ExternalExport <<EOD CatalogName ScratchDefault ValuesDefault ScratchDir SessionDB Sess sionDatabase SessionExpire VendRoot VendURL SecureURL Variable->SQLDSN Variable->SQLPASS Variable->SQLUSER EOD
After restarting Interchange, file /tmp/external
will
be created with the following contents (shown here in human-readable
format):
{ 'number_of_catalogs' => 4, 'Catalogs' => { 'catalog1' => { 'external_config' => { 'VendRoot' => '/home/interchange/catalog1', 'ValuesDefault' => {}, 'CatalogName' => 'catalog1', 'SessionExpire' => 3600, 'ScratchDefault' => { 'mv_no_session_id' => '1', 'mv_no_count' => '1', 'mv_add_dot_html' => '1' }, 'SessionDB' => '', 'ScratchDir' => '/home/interchange/catalog1/tmp', 'VendURL' => 'http://myhost.mydomain.local/cgi-bin/catalog1', 'SessionDatabase' => '/home/interchange/catalog1/session', 'SecureURL' => 'http://myhost.mydomain.local/cgi-bin/catalog1', 'Variable' => { 'SQLUSER' => 'interch', 'SQLDSN' => 'dbi:Pg:dbname=catalog1', 'SQLPASS' => 'interch' } } } } }
For discussion and examples of connecting Interchange to external programs, see glossary entry external.