perlapi.html

来自「perl教程」· HTML 代码 · 共 2,025 行 · 第 1/5 页

HTML
2,025 行
字号
<pre>
        I32     call_method(const char* methname, I32 flags)</pre>
</dd>
</li>
<dt><strong><a name="item_call_pv">call_pv</a></strong>

<dd>
<p>Performs a callback to the specified Perl sub.  See <a href="../../lib/Pod/perlcall.html">the perlcall manpage</a>.</p>
</dd>
<dd>
<p>NOTE: the perl_ form of this function is deprecated.</p>
</dd>
<dd>
<pre>
        I32     call_pv(const char* sub_name, I32 flags)</pre>
</dd>
</li>
<dt><strong><a name="item_call_sv">call_sv</a></strong>

<dd>
<p>Performs a callback to the Perl sub whose name is in the SV.  See
<a href="../../lib/Pod/perlcall.html">the perlcall manpage</a>.</p>
</dd>
<dd>
<p>NOTE: the perl_ form of this function is deprecated.</p>
</dd>
<dd>
<pre>
        I32     call_sv(SV* sv, I32 flags)</pre>
</dd>
</li>
<dt><strong><a name="item_enter">ENTER</a></strong>

<dd>
<p>Opening bracket on a callback.  See <a href="#item_leave"><code>LEAVE</code></a> and <a href="../../lib/Pod/perlcall.html">the perlcall manpage</a>.</p>
</dd>
<dd>
<pre>
                <span class="variable">ENTER</span><span class="operator">;</span>
</pre>
</dd>
</li>
<dt><strong><a name="item_eval_pv">eval_pv</a></strong>

<dd>
<p>Tells Perl to <a href="../../lib/Pod/perlfunc.html#item_eval"><code>eval</code></a> the given string and return an SV* result.</p>
</dd>
<dd>
<p>NOTE: the perl_ form of this function is deprecated.</p>
</dd>
<dd>
<pre>
        SV*     eval_pv(const char* p, I32 croak_on_error)</pre>
</dd>
</li>
<dt><strong><a name="item_eval_sv">eval_sv</a></strong>

<dd>
<p>Tells Perl to <a href="../../lib/Pod/perlfunc.html#item_eval"><code>eval</code></a> the string in the SV.</p>
</dd>
<dd>
<p>NOTE: the perl_ form of this function is deprecated.</p>
</dd>
<dd>
<pre>
        I32     eval_sv(SV* sv, I32 flags)</pre>
</dd>
</li>
<dt><strong><a name="item_freetmps">FREETMPS</a></strong>

<dd>
<p>Closing bracket for temporaries on a callback.  See <a href="#item_savetmps"><code>SAVETMPS</code></a> and
<a href="../../lib/Pod/perlcall.html">the perlcall manpage</a>.</p>
</dd>
<dd>
<pre>
                <span class="variable">FREETMPS</span><span class="operator">;</span>
</pre>
</dd>
</li>
<dt><strong><a name="item_leave">LEAVE</a></strong>

<dd>
<p>Closing bracket on a callback.  See <a href="#item_enter"><code>ENTER</code></a> and <a href="../../lib/Pod/perlcall.html">the perlcall manpage</a>.</p>
</dd>
<dd>
<pre>
                <span class="variable">LEAVE</span><span class="operator">;</span>
</pre>
</dd>
</li>
<dt><strong><a name="item_savetmps">SAVETMPS</a></strong>

<dd>
<p>Opening bracket for temporaries on a callback.  See <a href="#item_freetmps"><code>FREETMPS</code></a> and
<a href="../../lib/Pod/perlcall.html">the perlcall manpage</a>.</p>
</dd>
<dd>
<pre>
                <span class="variable">SAVETMPS</span><span class="operator">;</span>
</pre>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="character_classes">Character classes</a></h1>
<dl>
<dt><strong><a name="item_isalnum">isALNUM</a></strong>

<dd>
<p>Returns a boolean indicating whether the C <code>char</code> is an ASCII alphanumeric
character (including underscore) or digit.</p>
</dd>
<dd>
<pre>
        bool    isALNUM(char ch)</pre>
</dd>
</li>
<dt><strong><a name="item_isalpha">isALPHA</a></strong>

<dd>
<p>Returns a boolean indicating whether the C <code>char</code> is an ASCII alphabetic
character.</p>
</dd>
<dd>
<pre>
        bool    isALPHA(char ch)</pre>
</dd>
</li>
<dt><strong><a name="item_isdigit">isDIGIT</a></strong>

<dd>
<p>Returns a boolean indicating whether the C <code>char</code> is an ASCII
digit.</p>
</dd>
<dd>
<pre>
        bool    isDIGIT(char ch)</pre>
</dd>
</li>
<dt><strong><a name="item_islower">isLOWER</a></strong>

<dd>
<p>Returns a boolean indicating whether the C <code>char</code> is a lowercase
character.</p>
</dd>
<dd>
<pre>
        bool    isLOWER(char ch)</pre>
</dd>
</li>
<dt><strong><a name="item_isspace">isSPACE</a></strong>

<dd>
<p>Returns a boolean indicating whether the C <code>char</code> is whitespace.</p>
</dd>
<dd>
<pre>
        bool    isSPACE(char ch)</pre>
</dd>
</li>
<dt><strong><a name="item_isupper">isUPPER</a></strong>

<dd>
<p>Returns a boolean indicating whether the C <code>char</code> is an uppercase
character.</p>
</dd>
<dd>
<pre>
        bool    isUPPER(char ch)</pre>
</dd>
</li>
<dt><strong><a name="item_tolower">toLOWER</a></strong>

<dd>
<p>Converts the specified character to lowercase.</p>
</dd>
<dd>
<pre>
        char    toLOWER(char ch)</pre>
</dd>
</li>
<dt><strong><a name="item_toupper">toUPPER</a></strong>

<dd>
<p>Converts the specified character to uppercase.</p>
</dd>
<dd>
<pre>
        char    toUPPER(char ch)</pre>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="cloning_an_interpreter">Cloning an interpreter</a></h1>
<dl>
<dt><strong><a name="item_perl_clone">perl_clone</a></strong>

<dd>
<p>Create and return a new interpreter by cloning the current one.</p>
</dd>
<dd>
<p>perl_clone takes these flags as parameters:</p>
</dd>
<dd>
<p>CLONEf_COPY_STACKS - is used to, well, copy the stacks also, 
without it we only clone the data and zero the stacks, 
with it we copy the stacks and the new perl interpreter is 
ready to run at the exact same point as the previous one. 
The pseudo-fork code uses COPY_STACKS while the 
threads-&gt;new doesn't.</p>
</dd>
<dd>
<p>CLONEf_KEEP_PTR_TABLE
perl_clone keeps a ptr_table with the pointer of the old 
variable as a key and the new variable as a value, 
this allows it to check if something has been cloned and not 
clone it again but rather just use the value and increase the 
refcount. If KEEP_PTR_TABLE is not set then perl_clone will kill 
the ptr_table using the function 
<code>ptr_table_free(PL_ptr_table); PL_ptr_table = NULL;</code>, 
reason to keep it around is if you want to dup some of your own 
variable who are outside the graph perl scans, example of this 
code is in threads.xs create</p>
</dd>
<dd>
<p>CLONEf_CLONE_HOST
This is a win32 thing, it is ignored on unix, it tells perls 
win32host code (which is c++) to clone itself, this is needed on 
win32 if you want to run two threads at the same time, 
if you just want to do some stuff in a separate perl interpreter 
and then throw it away and return to the original one, 
you don't need to do anything.</p>
</dd>
<dd>
<pre>
        PerlInterpreter*        perl_clone(PerlInterpreter* interp, UV flags)</pre>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="cv_manipulation_functions">CV Manipulation Functions</a></h1>
<dl>
<dt><strong><a name="item_cvstash">CvSTASH</a></strong>

<dd>
<p>Returns the stash of the CV.</p>
</dd>
<dd>
<pre>
        HV*     CvSTASH(CV* cv)</pre>
</dd>
</li>
<dt><strong><a name="item_get_cv">get_cv</a></strong>

<dd>
<p>Returns the CV of the specified Perl subroutine.  If <code>create</code> is set and
the Perl subroutine does not exist then it will be declared (which has the
same effect as saying <code>sub name;</code>).  If <code>create</code> is not set and the
subroutine does not exist then NULL is returned.</p>
</dd>
<dd>
<p>NOTE: the perl_ form of this function is deprecated.</p>
</dd>
<dd>
<pre>
        CV*     get_cv(const char* name, I32 create)</pre>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="embedding_functions">Embedding Functions</a></h1>
<dl>
<dt><strong><a name="item_cv_undef">cv_undef</a></strong>

<dd>
<p>Clear out all the active components of a CV. This can happen either
by an explicit <code>undef &amp;foo</code>, or by the reference count going to zero.
In the former case, we keep the CvOUTSIDE pointer, so that any anonymous
children can still follow the full lexical scope chain.</p>
</dd>
<dd>
<pre>
        void    cv_undef(CV* cv)</pre>
</dd>
</li>
<dt><strong><a name="item_load_module">load_module</a></strong>

<dd>
<p>Loads the module whose name is pointed to by the string part of name.
Note that the actual module name, not its filename, should be given.
Eg, &quot;Foo::Bar&quot; instead of &quot;Foo/Bar.pm&quot;.  flags can be any of
PERL_LOADMOD_DENY, PERL_LOADMOD_NOIMPORT, or PERL_LOADMOD_IMPORT_OPS
(or 0 for no flags). ver, if specified, provides version semantics
similar to <code>use Foo::Bar VERSION</code>.  The optional trailing SV*
arguments can be used to specify arguments to the module's <a href="../../lib/Pod/perlfunc.html#item_import"><code>import()</code></a>
method, similar to <code>use Foo::Bar VERSION LIST</code>.</p>
</dd>
<dd>
<pre>
        void    load_module(U32 flags, SV* name, SV* ver, ...)</pre>
</dd>
</li>
<dt><strong><a name="item_nothreadhook">nothreadhook</a></strong>

<dd>
<p>Stub that provides thread hook for perl_destruct when there are
no threads.</p>
</dd>
<dd>
<pre>
        int     nothreadhook()</pre>
</dd>
</li>
<dt><strong><a name="item_perl_alloc">perl_alloc</a></strong>

<dd>
<p>Allocates a new Perl interpreter.  See <a href="../../lib/Pod/perlembed.html">the perlembed manpage</a>.</p>
</dd>
<dd>
<pre>
        PerlInterpreter*        perl_alloc()</pre>
</dd>
</li>
<dt><strong><a name="item_perl_construct">perl_construct</a></strong>

<dd>
<p>Initializes a new Perl interpreter.  See <a href="../../lib/Pod/perlembed.html">the perlembed manpage</a>.</p>
</dd>
<dd>
<pre>
        void    perl_construct(PerlInterpreter* interp)</pre>
</dd>
</li>
<dt><strong><a name="item_perl_destruct">perl_destruct</a></strong>

<dd>
<p>Shuts down a Perl interpreter.  See <a href="../../lib/Pod/perlembed.html">the perlembed manpage</a>.</p>
</dd>
<dd>
<pre>
        int     perl_destruct(PerlInterpreter* interp)</pre>
</dd>
</li>
<dt><strong><a name="item_perl_free">perl_free</a></strong>

<dd>
<p>Releases a Perl interpreter.  See <a href="../../lib/Pod/perlembed.html">the perlembed manpage</a>.</p>
</dd>
<dd>
<pre>
        void    perl_free(PerlInterpreter* interp)</pre>
</dd>
</li>
<dt><strong><a name="item_perl_parse">perl_parse</a></strong>

<dd>
<p>Tells a Perl interpreter to parse a Perl script.  See <a href="../../lib/Pod/perlembed.html">the perlembed manpage</a>.</p>
</dd>
<dd>
<pre>
        int     perl_parse(PerlInterpreter* interp, XSINIT_t xsinit, int argc, char** argv, char** env)</pre>
</dd>
</li>
<dt><strong><a name="item_perl_run">perl_run</a></strong>

<dd>
<p>Tells a Perl interpreter to run.  See <a href="../../lib/Pod/perlembed.html">the perlembed manpage</a>.</p>
</dd>
<dd>
<pre>
        int     perl_run(PerlInterpreter* interp)</pre>
</dd>
</li>
<dt><strong><a name="item_require_pv">require_pv</a></strong>

<dd>
<p>Tells Perl to <a href="../../lib/Pod/perlfunc.html#item_require"><code>require</code></a> the file named by the string argument.  It is
analogous to the Perl code <code>eval &quot;require '$file'&quot;</code>.  It's even
implemented that way; consider using load_module instead.</p>
</dd>
<dd>
<p>NOTE: the perl_ form of this function is deprecated.</p>
</dd>
<dd>
<pre>
        void    require_pv(const char* pv)</pre>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="functions_in_file_pp_pack_c">Functions in file pp_pack.c</a></h1>
<dl>
<dt><strong><a name="item_packlist">packlist</a></strong>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?