… | |
… | |
61 | utf8_length scalar |
61 | utf8_length scalar |
62 | Returns the number of characters in the string, counting wide UTF8 |
62 | Returns the number of characters in the string, counting wide UTF8 |
63 | characters as a single character, independent of wether the scalar |
63 | characters as a single character, independent of wether the scalar |
64 | is marked as containing bytes or mulitbyte characters. |
64 | is marked as containing bytes or mulitbyte characters. |
65 | |
65 | |
|
|
66 | $old = readonly scalar[, $new] |
|
|
67 | Returns whether the scalar is currently readonly, and sets or clears |
|
|
68 | the readonly status if a new status is given. |
|
|
69 | |
|
|
70 | readonly_on scalar |
|
|
71 | Sets the readonly flag on the scalar. |
|
|
72 | |
|
|
73 | readonly_off scalar |
|
|
74 | Clears the readonly flag on the scalar. |
|
|
75 | |
66 | unmagic scalar, type |
76 | unmagic scalar, type |
67 | Remove the specified magic from the scalar (DANGEROUS!). |
77 | Remove the specified magic from the scalar (DANGEROUS!). |
68 | |
78 | |
69 | weaken scalar |
79 | weaken scalar |
70 | Weaken a reference. (See also WeakRef). |
80 | Weaken a reference. (See also WeakRef). |
… | |
… | |
76 | returns true when the scalar is tainted, false otherwise. |
86 | returns true when the scalar is tainted, false otherwise. |
77 | |
87 | |
78 | untaint scalar |
88 | untaint scalar |
79 | Remove the tainted flag from the specified scalar. |
89 | Remove the tainted flag from the specified scalar. |
80 | |
90 | |
|
|
91 | length = len scalar |
|
|
92 | Returns SvLEN (scalar), that is, the actual number of bytes |
|
|
93 | allocated to the string value, or "undef", is the scalar has no |
|
|
94 | string value. |
|
|
95 | |
81 | grow scalar, newlen |
96 | scalar = grow scalar, newlen |
82 | Sets the memory area used for the scalar to the given length, if the |
97 | Sets the memory area used for the scalar to the given length, if the |
83 | current length is less than the new value. This does not affect the |
98 | current length is less than the new value. This does not affect the |
84 | contents of the scalar, but is only useful to "pre-allocate" memory |
99 | contents of the scalar, but is only useful to "pre-allocate" memory |
85 | space if you know the scalar will grow. The return value is the |
100 | space if you know the scalar will grow. The return value is the |
86 | modified scalar (the scalar is modified in-place). |
101 | modified scalar (the scalar is modified in-place). |
|
|
102 | |
|
|
103 | scalar = extend scalar, addlen=64 |
|
|
104 | Reserves enough space in the scalar so that addlen bytes can be |
|
|
105 | appended without reallocating it. The actual contents of the scalar |
|
|
106 | will not be affected. The modified scalar will also be returned. |
|
|
107 | |
|
|
108 | This function is meant to make append workloads efficient - if you |
|
|
109 | append a short string to a scalar many times (millions of times), |
|
|
110 | then perl will have to reallocate and copy the scalar basically |
|
|
111 | every time. |
|
|
112 | |
|
|
113 | If you instead use "extend $scalar, length $shortstring", then |
|
|
114 | Convert::Scalar will use a "size to next power of two, roughly" |
|
|
115 | algorithm, so as the scalar grows, perl will have to resize and copy |
|
|
116 | it less and less often. |
|
|
117 | |
|
|
118 | nread = extend_read fh, scalar, addlen=64 |
|
|
119 | Calls "extend scalar, addlen" to ensure some space is available, |
|
|
120 | then do the equivalent of "sysread" to the end, to try to fill the |
|
|
121 | extra space. Returns how many bytes have been read, 0 on EOF or |
|
|
122 | undef> on eror, just like "sysread". |
|
|
123 | |
|
|
124 | This function is useful to implement many protocols where you read |
|
|
125 | some data, see if it is enough to decode, and if not, read some |
|
|
126 | more, where the naive or easy way of doing this would result in bad |
|
|
127 | performance. |
|
|
128 | |
|
|
129 | nread = read_all fh, scalar, length |
|
|
130 | Tries to read "length" bytes into "scalar". Unlike "read" or |
|
|
131 | "sysread", it will try to read more bytes if not all bytes could be |
|
|
132 | read in one go (this is often called "xread" in C). |
|
|
133 | |
|
|
134 | Returns the total nunmber of bytes read (normally "length", unless |
|
|
135 | an error or EOF occured), 0 on EOF and "undef" on errors. |
|
|
136 | |
|
|
137 | nwritten = write_all fh, scalar |
|
|
138 | Like "readall", but for writes - the equivalent of the "xwrite" |
|
|
139 | function often seen in C. |
87 | |
140 | |
88 | refcnt scalar[, newrefcnt] |
141 | refcnt scalar[, newrefcnt] |
89 | Returns the current reference count of the given scalar and |
142 | Returns the current reference count of the given scalar and |
90 | optionally sets it to the given reference count. |
143 | optionally sets it to the given reference count. |
91 | |
144 | |
… | |
… | |
98 | Better yet: don't use this module in this case. |
151 | Better yet: don't use this module in this case. |
99 | |
152 | |
100 | refcnt_rv scalar[, newrefcnt] |
153 | refcnt_rv scalar[, newrefcnt] |
101 | Works like "refcnt", but dereferences the given reference first. |
154 | Works like "refcnt", but dereferences the given reference first. |
102 | This is useful to find the reference count of arrays or hashes, |
155 | This is useful to find the reference count of arrays or hashes, |
103 | which cnanot be passed directly. Remember that taking a reference of |
156 | which cannot be passed directly. Remember that taking a reference of |
104 | some object increases it's reference count, so the reference count |
157 | some object increases it's reference count, so the reference count |
105 | used by the *_rv-functions tend to be one higher. |
158 | used by the *_rv-functions tend to be one higher. |
106 | |
159 | |
107 | refcnt_inc_rv scalar |
160 | refcnt_inc_rv scalar |
108 | Works like "refcnt_inc", but dereferences the given reference first. |
161 | Works like "refcnt_inc", but dereferences the given reference first. |