Previous: Associating Information to an Output File, Up: Dynamic Conversion Information [Contents][Index]
For information shared among formatting functions without involving the
converter, the function shared_conversion_state
can be used both for
initialization of shared information and to share information:
$reference =
$converter->shared_conversion_state ($name, $initialization)
¶Return the reference $reference associated with $name. $initialization is only read the first time $name is seen and sets up the reference that will be reused afterwards. If $initialization is a scalar (string or integer, for example), a reference on a scalar is returned, the associated value being set to $initialization. Otherwise, $initialization should be a reference on a hash or on an array.
The converter is used to hold the information, but does not use nor write.
Examples of use:
my $explained_commands_hash = $converter->shared_conversion_state('explained_commands', {}); $explained_commands_hash->{'key'} = 'value'; my $foot_num_reference = $converter->shared_conversion_state('footnote_number', 0); ${$foot_num_reference}++;