Perl 5 version 12.1 documentation
ExtUtils::XSSymSet - keep sets of symbol names palatable to the VMS linker
Since the VMS linker distinguishes symbols based only on the first 31
characters of their names, it is occasionally necessary to shorten
symbol names in order to avoid collisions. (This is especially true of
names generated by xsubpp, since prefixes generated by nested package
names can become quite long.)
provides functions to
shorten names in a consistent fashion, and to track a set of names to
insure that each is unique. While designed with xsubpp in mind, it
may be used with any set of strings.
This package supplies the following functions, all of which should be called as methods.
Creates an empty
ExtUtils::XSSymsetset of symbols. This function may be called as a static method or via an existing object. If
$silentare specified, they are used as the defaults for maximum name length and warning behavior in future calls to addsym() or trimsym() via this object.
Creates a symbol name from
$name, using the methods described under trimsym(), which is unique in this set of symbols, and returns the new name.
$nameand its resultant are added to the set, and any future calls to addsym() specifying the same
$namewill return the same result, regardless of the value of
$silentis true, warnings are output if
$namehad to be trimmed or changed in order to avoid collision with an existing symbol name.
$silentdefault to the values specified when this set of symbols was created. This method must be called via an existing object.
Creates a symbol name
$maxlenor fewer characters long from
$nameand returns it. If
$nameis too long, it first tries to shorten it by removing duplicate characters, then by periodically removing non-underscore characters, and finally, if necessary, by periodically removing characters of any type.
$maxlendefaults to 31. Unless
$silentis true, a warning is output if
$nameis altered in any way. This function may be called either as a static method or via an existing object, but in the latter case no check is made to insure that the resulting name is unique in the set of symbols.
$namefrom the set of symbols, where
$nameis the original symbol name passed previously to addsym(). If
$nameexisted in the set of symbols, returns its "trimmed" equivalent, otherwise returns
undef. This method must be called via an existing object.
Returns the original name which was trimmed to
$trimmedby a previous call to addsym(), or
$trimmeddoes not correspond to a member of this set of symbols. This method must be called via an existing object.
Returns the trimmed name which was generated from
$nameby a previous call to addsym(), or
$nameis not a member of this set of symbols. This method must be called via an existing object.
Returns a list containing all of the original symbol names from this set.
Returns a list containing all of the trimmed symbol names from this set.
Charles Bailey <firstname.lastname@example.org>
Last revised 14-Feb-1997, for Perl 5.004.