1ExtUtils::XSSymSet(3pm)Perl Programmers Reference GuideExtUtils::XSSymSet(3pm)
2
3
4

NAME

6       ExtUtils::XSSymSet - keep sets of symbol names palatable to the VMS
7       linker
8

SYNOPSIS

10         use ExtUtils::XSSymSet;
11
12         $set = new ExtUtils::XSSymSet;
13         while ($sym = make_symbol()) { $set->addsym($sym); }
14         foreach $safesym ($set->all_trimmed) {
15           print "Processing $safesym (derived from ",$self->get_orig($safesym),")\n";
16           do_stuff($safesym);
17         }
18
19         $safesym = ExtUtils::XSSymSet->trimsym($onesym);
20

DESCRIPTION

22       Since the VMS linker distinguishes symbols based only on the first 31
23       characters of their names, it is occasionally necessary to shorten
24       symbol names in order to avoid collisions.  (This is especially true of
25       names generated by xsubpp, since prefixes generated by nested package
26       names can become quite long.)  "ExtUtils::XSSymSet" provides functions
27       to shorten names in a consistent fashion, and to track a set of names
28       to insure that each is unique.  While designed with xsubpp in mind, it
29       may be used with any set of strings.
30
31       This package supplies the following functions, all of which should be
32       called as methods.
33
34       new([$maxlen[,$silent]])
35           Creates an empty "ExtUtils::XSSymset" set of symbols.  This
36           function may be called as a static method or via an existing
37           object.  If $maxlen or $silent are specified, they are used as the
38           defaults for maximum name length and warning behavior in future
39           calls to addsym() or trimsym() via this object.  If the compiler
40           has been instructed to do its own symbol shortening via
41           $Config{'useshortenedsymbols'}, a value of 2048 is assumed for
42           $maxlen as a way of bypassing the shortening done by this module.
43
44       addsym($name[,$maxlen[,$silent]])
45           Creates a symbol name from $name, using the methods described under
46           trimsym(), which is unique in this set of symbols, and returns the
47           new name.  $name and its resultant are added to the set, and any
48           future calls to addsym() specifying the same $name will return the
49           same result, regardless of the value of $maxlen specified.  Unless
50           $silent is true, warnings are output if $name had to be trimmed or
51           changed in order to avoid collision with an existing symbol name.
52           $maxlen and $silent default to the values specified when this set
53           of symbols was created.  This method must be called via an existing
54           object.
55
56       trimsym($name[,$maxlen[,$silent]])
57           Creates a symbol name $maxlen or fewer characters long from $name
58           and returns it. If $name is too long, it first tries to shorten it
59           by removing duplicate characters, then by periodically removing
60           non-underscore characters, and finally, if necessary, by
61           periodically removing characters of any type.  $maxlen defaults to
62           31.  Unless $silent is true, a warning is output if $name is
63           altered in any way.  This function may be called either as a static
64           method or via an existing object, but in the latter case no check
65           is made to insure that the resulting name is unique in the set of
66           symbols.    If the compiler has been instructed to do its own
67           symbol shortening via $Config{'useshortenedsymbols'}, a value of
68           2048 is assumed for $maxlen as a way of bypassing the shortening
69           done by this module.
70
71       delsym($name)
72           Removes $name from the set of symbols, where $name is the original
73           symbol name passed previously to addsym().  If $name existed in the
74           set of symbols, returns its "trimmed" equivalent, otherwise returns
75           "undef".  This method must be called via an existing object.
76
77       get_orig($trimmed)
78           Returns the original name which was trimmed to $trimmed by a
79           previous call to addsym(), or "undef" if $trimmed does not
80           correspond to a member of this set of symbols.  This method must be
81           called via an existing object.
82
83       get_trimmed($name)
84           Returns the trimmed name which was generated from $name by a
85           previous call to addsym(), or "undef" if $name is not a member of
86           this set of symbols.  This method must be called via an existing
87           object.
88
89       all_orig()
90           Returns a list containing all of the original symbol names from
91           this set.
92
93       all_trimmed()
94           Returns a list containing all of the trimmed symbol names from this
95           set.
96

AUTHOR

98       Charles Bailey  <bailey@newman.upenn.edu>
99

REVISION

101       Last revised 8-Oct-2010, for Perl 5.13.6.
102
103
104
105perl v5.16.3                      2013-03-04           ExtUtils::XSSymSet(3pm)
Impressum