NAME
Inline::SLang::Details - How Inline::SLang works
DESCRIPTION
#
# This document was added in version 0.21 of Inline::SLang and
# is not complete
#
This document is intended to provide details of how Inline::SLang weaves its magic. It's probably going to be most use in cases when you find apparently bizarre behaviour and wonder if it is a bug or a feature.
The implementation for Inline::SLang was initally based on the code found in Neil Watkiss' Inline::Python and Inline::Ruby modules. However, all bugs are my own creation.
What happens when Perl starts?
If the Perl code has not been evaluated before - or if it has been changed since the previous run - the Inline code kicks in to evaluate the S-Lang code. This involves:
The S-Lang interpreter is started and queried to find out all functions that are defined in the namespaces listed in the
BIND_NS
configuration option. The user-supplied S-Lang code is then evaluated and the same set of namespaces are again queried for the names of defined functions. We also pick up any new namespaces that may have been defined if theBIND_NS
option is set toAll
.The names of the new functions - i.e. those functions added by the user-supplied S-Lang code which the S-Lang function
_apropos()
, using a flag value of 3, lists - are stored for later use.Complications are:
The "_inline" namespace is ignored since this is used by the module and should be considered off-limits.
The list of functions in
bind_slfuncs
is added to the list of functions to bind. This list can include functions defined as part of the S-Lang Run-Time Library.The fact that the module allows users to change the name that namespaces and (some) functions have when mapped to Perl.
The list of defined S-Lang data types is found. This includes user-defined types added by any imported modules and "named" structures created via a S-Lang
typedef
statement.Utility functions are created in Perl in the
Inline::SLang
package which are wrappers around calls to theDataType_Type
constructor. This allows users to sayInline::SLang::UShort_Type()
rather thanDataType_Type->new("UShort_Type")
.For those types we do not recognise - essentially all user-defined types - we create objects with names equal to the S-Lang variable name.