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.
40
41       addsym($name[,$maxlen[,$silent]])
42           Creates a symbol name from $name, using the methods described under
43           trimsym(), which is unique in this set of symbols, and returns the
44           new name.  $name and its resultant are added to the set, and any
45           future calls to addsym() specifying the same $name will return the
46           same result, regardless of the value of $maxlen specified.  Unless
47           $silent is true, warnings are output if $name had to be trimmed or
48           changed in order to avoid collision with an existing symbol name.
49           $maxlen and $silent default to the values specified when this set
50           of symbols was created.  This method must be called via an existing
51           object.
52
53       trimsym($name[,$maxlen[,$silent]])
54           Creates a symbol name $maxlen or fewer characters long from $name
55           and returns it. If $name is too long, it first tries to shorten it
56           by removing duplicate characters, then by periodically removing
57           non-underscore characters, and finally, if necessary, by
58           periodically removing characters of any type.  $maxlen defaults to
59           31.  Unless $silent is true, a warning is output if $name is
60           altered in any way.  This function may be called either as a static
61           method or via an existing object, but in the latter case no check
62           is made to insure that the resulting name is unique in the set of
63           symbols.
64
65       delsym($name)
66           Removes $name from the set of symbols, where $name is the original
67           symbol name passed previously to addsym().  If $name existed in the
68           set of symbols, returns its "trimmed" equivalent, otherwise returns
69           "undef".  This method must be called via an existing object.
70
71       get_orig($trimmed)
72           Returns the original name which was trimmed to $trimmed by a
73           previous call to addsym(), or "undef" if $trimmed does not
74           correspond to a member of this set of symbols.  This method must be
75           called via an existing object.
76
77       get_trimmed($name)
78           Returns the trimmed name which was generated from $name by a
79           previous call to addsym(), or "undef" if $name is not a member of
80           this set of symbols.  This method must be called via an existing
81           object.
82
83       all_orig()
84           Returns a list containing all of the original symbol names from
85           this set.
86
87       all_trimmed()
88           Returns a list containing all of the trimmed symbol names from this
89           set.
90

AUTHOR

92       Charles Bailey  <bailey@newman.upenn.edu>
93

REVISION

95       Last revised 14-Feb-1997, for Perl 5.004.
96
97
98
99perl v5.12.4                      2011-06-07           ExtUtils::XSSymSet(3pm)
Impressum