📄 perlapi.1
字号:
.Ve.SpEscapes at most the first \*(L"count\*(R" chars of pv and puts the results intodsv such that the size of the escaped string will not exceed \*(L"max\*(R" charsand will not contain any incomplete escape sequences..SpIf flags contains \s-1PERL_PV_ESCAPE_QUOTE\s0 then any double quotes in the stringwill also be escaped..SpNormally the \s-1SV\s0 will be cleared before the escaped string is prepared,but when \s-1PERL_PV_ESCAPE_NOCLEAR\s0 is set this will not occur..SpIf \s-1PERL_PV_ESCAPE_UNI\s0 is set then the input string is treated as Unicode,if \s-1PERL_PV_ESCAPE_UNI_DETECT\s0 is set then the input string is scannedusing \f(CW\*(C`is_utf8_string()\*(C'\fR to determine if it is Unicode..SpIf \s-1PERL_PV_ESCAPE_ALL\s0 is set then all input chars will be outputusing \f(CW\*(C`\ex01F1\*(C'\fR style escapes, otherwise only chars above 255 will beescaped using this style, other non printable chars will use octal orcommon escaped patterns like \f(CW\*(C`\en\*(C'\fR. If \s-1PERL_PV_ESCAPE_NOBACKSLASH\s0then all chars below 255 will be treated as printable and will be output as literals..SpIf \s-1PERL_PV_ESCAPE_FIRSTCHAR\s0 is set then only the first char of thestring will be escaped, regardles of max. If the string is utf8 and the chars value is >255 then it will be returned as a plain hex sequence. Thus the output will either be a single char, an octal escape sequence, a special escape like \f(CW\*(C`\en\*(C'\fR or a 3 or more digit hex value..SpIf \s-1PERL_PV_ESCAPE_RE\s0 is set then the escape char used will be a '%' andnot a '\e\e'. This is because regexes very often contain backslashedsequences, whereas '%' is not a particularly common character in patterns..SpReturns a pointer to the escaped text as held by dsv..Sp\&\s-1NOTE:\s0 the perl_ form of this function is deprecated..Sp.Vb 1\& char* pv_escape(SV *dsv, char const * const str, const STRLEN count, const STRLEN max, STRLEN * const escaped, const U32 flags).Ve.IP "pv_pretty" 8.IX Xref "pv_pretty".IX Item "pv_pretty".Vb 3\& |const STRLEN count|const STRLEN max\e\& |const char const *start_color| const char const *end_color\e\& |const U32 flags.Ve.SpConverts a string into something presentable, handling escaping via\&\fIpv_escape()\fR and supporting quoting and ellipses..SpIf the \s-1PERL_PV_PRETTY_QUOTE\s0 flag is set then the result will be double quoted with any double quotes in the string escaped. Otherwiseif the \s-1PERL_PV_PRETTY_LTGT\s0 flag is set then the result be wrapped inangle brackets..SpIf the \s-1PERL_PV_PRETTY_ELLIPSES\s0 flag is set and not all characters instring were output then an ellipsis \f(CW\*(C`...\*(C'\fR will be appended to thestring. Note that this happens \s-1AFTER\s0 it has been quoted..SpIf start_color is non-null then it will be inserted after the openingquote (if there is one) but before the escaped text. If end_coloris non-null then it will be inserted after the escaped text but beforeany quotes or ellipses..SpReturns a pointer to the prettified text as held by dsv..Sp\&\s-1NOTE:\s0 the perl_ form of this function is deprecated..Sp.Vb 1\& char* pv_pretty(SV *dsv, char const * const str, const STRLEN count, const STRLEN max, char const * const start_color, char const * const end_color, const U32 flags).Ve.SH "Functions in file mathoms.c".IX Header "Functions in file mathoms.c".IP "gv_fetchmethod" 8.IX Xref "gv_fetchmethod".IX Item "gv_fetchmethod"See gv_fetchmethod_autoload..Sp.Vb 1\& GV* gv_fetchmethod(HV* stash, const char* name).Ve.IP "pack_cat" 8.IX Xref "pack_cat".IX Item "pack_cat"The engine implementing \fIpack()\fR Perl function. Note: parameters next_in_list andflags are not used. This call should not be used; use packlist instead..Sp.Vb 1\& void pack_cat(SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist, SV ***next_in_list, U32 flags).Ve.IP "sv_2pvbyte_nolen" 8.IX Xref "sv_2pvbyte_nolen".IX Item "sv_2pvbyte_nolen"Return a pointer to the byte-encoded representation of the \s-1SV\s0.May cause the \s-1SV\s0 to be downgraded from \s-1UTF\-8\s0 as a side-effect..SpUsually accessed via the \f(CW\*(C`SvPVbyte_nolen\*(C'\fR macro..Sp.Vb 1\& char* sv_2pvbyte_nolen(SV* sv).Ve.IP "sv_2pvutf8_nolen" 8.IX Xref "sv_2pvutf8_nolen".IX Item "sv_2pvutf8_nolen"Return a pointer to the UTF\-8\-encoded representation of the \s-1SV\s0.May cause the \s-1SV\s0 to be upgraded to \s-1UTF\-8\s0 as a side-effect..SpUsually accessed via the \f(CW\*(C`SvPVutf8_nolen\*(C'\fR macro..Sp.Vb 1\& char* sv_2pvutf8_nolen(SV* sv).Ve.IP "sv_2pv_nolen" 8.IX Xref "sv_2pv_nolen".IX Item "sv_2pv_nolen"Like \f(CW\*(C`sv_2pv()\*(C'\fR, but doesn't return the length too. You should usuallyuse the macro wrapper \f(CW\*(C`SvPV_nolen(sv)\*(C'\fR instead. char* sv_2pv_nolen(SV* sv).IP "sv_catpvn_mg" 8.IX Xref "sv_catpvn_mg".IX Item "sv_catpvn_mg"Like \f(CW\*(C`sv_catpvn\*(C'\fR, but also handles 'set' magic..Sp.Vb 1\& void sv_catpvn_mg(SV *sv, const char *ptr, STRLEN len).Ve.IP "sv_catsv_mg" 8.IX Xref "sv_catsv_mg".IX Item "sv_catsv_mg"Like \f(CW\*(C`sv_catsv\*(C'\fR, but also handles 'set' magic..Sp.Vb 1\& void sv_catsv_mg(SV *dstr, SV *sstr).Ve.IP "sv_force_normal" 8.IX Xref "sv_force_normal".IX Item "sv_force_normal"Undo various types of fakery on an \s-1SV:\s0 if the \s-1PV\s0 is a shared string, makea private copy; if we're a ref, stop refing; if we're a glob, downgrade toan xpvmg. See also \f(CW\*(C`sv_force_normal_flags\*(C'\fR..Sp.Vb 1\& void sv_force_normal(SV *sv).Ve.IP "sv_iv" 8.IX Xref "sv_iv".IX Item "sv_iv"A private implementation of the \f(CW\*(C`SvIVx\*(C'\fR macro for compilers which can'tcope with complex macro expressions. Always use the macro instead..Sp.Vb 1\& IV sv_iv(SV* sv).Ve.IP "sv_nolocking" 8.IX Xref "sv_nolocking".IX Item "sv_nolocking"Dummy routine which \*(L"locks\*(R" an \s-1SV\s0 when there is no locking module present.Exists to avoid test for a \s-1NULL\s0 function pointer and because it couldpotentially warn under some level of strict-ness..Sp\&\*(L"Superseded\*(R" by \fIsv_nosharing()\fR..Sp.Vb 1\& void sv_nolocking(SV *sv).Ve.IP "sv_nounlocking" 8.IX Xref "sv_nounlocking".IX Item "sv_nounlocking"Dummy routine which \*(L"unlocks\*(R" an \s-1SV\s0 when there is no locking module present.Exists to avoid test for a \s-1NULL\s0 function pointer and because it couldpotentially warn under some level of strict-ness..Sp\&\*(L"Superseded\*(R" by \fIsv_nosharing()\fR..Sp.Vb 1\& void sv_nounlocking(SV *sv).Ve.IP "sv_nv" 8.IX Xref "sv_nv".IX Item "sv_nv"A private implementation of the \f(CW\*(C`SvNVx\*(C'\fR macro for compilers which can'tcope with complex macro expressions. Always use the macro instead..Sp.Vb 1\& NV sv_nv(SV* sv).Ve.IP "sv_pv" 8.IX Xref "sv_pv".IX Item "sv_pv"Use the \f(CW\*(C`SvPV_nolen\*(C'\fR macro instead.Sp.Vb 1\& char* sv_pv(SV *sv).Ve.IP "sv_pvbyte" 8.IX Xref "sv_pvbyte".IX Item "sv_pvbyte"Use \f(CW\*(C`SvPVbyte_nolen\*(C'\fR instead..Sp.Vb 1\& char* sv_pvbyte(SV *sv).Ve.IP "sv_pvbyten" 8.IX Xref "sv_pvbyten".IX Item "sv_pvbyten"A private implementation of the \f(CW\*(C`SvPVbyte\*(C'\fR macro for compilerswhich can't cope with complex macro expressions. Always use the macroinstead..Sp.Vb 1\& char* sv_pvbyten(SV *sv, STRLEN *len).Ve.IP "sv_pvn" 8.IX Xref "sv_pvn".IX Item "sv_pvn"A private implementation of the \f(CW\*(C`SvPV\*(C'\fR macro for compilers which can'tcope with complex macro expressions. Always use the macro instead..Sp.Vb 1\& char* sv_pvn(SV *sv, STRLEN *len).Ve.IP "sv_pvutf8" 8.IX Xref "sv_pvutf8".IX Item "sv_pvutf8"Use the \f(CW\*(C`SvPVutf8_nolen\*(C'\fR macro instead.Sp.Vb 1\& char* sv_pvutf8(SV *sv).Ve.IP "sv_pvutf8n" 8.IX Xref "sv_pvutf8n".IX Item "sv_pvutf8n"A private implementation of the \f(CW\*(C`SvPVutf8\*(C'\fR macro for compilerswhich can't cope with complex macro expressions. Always use the macroinstead..Sp.Vb 1\& char* sv_pvutf8n(SV *sv, STRLEN *len).Ve.IP "sv_taint" 8.IX Xref "sv_taint".IX Item "sv_taint"Taint an \s-1SV\s0. Use \f(CW\*(C`SvTAINTED_on\*(C'\fR instead. void sv_taint(SV* sv).IP "sv_unref" 8.IX Xref "sv_unref".IX Item "sv_unref"Unsets the \s-1RV\s0 status of the \s-1SV\s0, and decrements the reference count ofwhatever was being referenced by the \s-1RV\s0. This can almost be thought ofas a reversal of \f(CW\*(C`newSVrv\*(C'\fR. This is \f(CW\*(C`sv_unref_flags\*(C'\fR with the \f(CW\*(C`flag\*(C'\fRbeing zero. See \f(CW\*(C`SvROK_off\*(C'\fR..Sp.Vb 1\& void sv_unref(SV* sv).Ve.IP "sv_usepvn" 8.IX Xref "sv_usepvn".IX Item "sv_usepvn"Tells an \s-1SV\s0 to use \f(CW\*(C`ptr\*(C'\fR to find its string value. Implemented bycalling \f(CW\*(C`sv_usepvn_flags\*(C'\fR with \f(CW\*(C`flags\*(C'\fR of 0, hence does not handle 'set'magic. See \f(CW\*(C`sv_usepvn_flags\*(C'\fR..Sp.Vb 1\& void sv_usepvn(SV* sv, char* ptr, STRLEN len).Ve.IP "sv_usepvn_mg" 8.IX Xref "sv_usepvn_mg".IX Item "sv_usepvn_mg"Like \f(CW\*(C`sv_usepvn\*(C'\fR, but also handles 'set' magic..Sp.Vb 1\& void sv_usepvn_mg(SV *sv, char *ptr, STRLEN len).Ve.IP "sv_uv" 8.IX Xref "sv_uv".IX Item "sv_uv"A private implementation of the \f(CW\*(C`SvUVx\*(C'\fR macro for compilers which can'tcope with complex macro expressions. Always use the macro instead..Sp.Vb 1\& UV sv_uv(SV* sv).Ve.IP "unpack_str" 8.IX Xref "unpack_str".IX Item "unpack_str"The engine implementing \fIunpack()\fR Perl function. Note: parameters strbeg, new_sand ocnt are not used. This call should not be used, use unpackstring instead..Sp.Vb 1\& I32 unpack_str(const char *pat, const char *patend, const char *s, const char *strbeg, const char *strend, char **new_s, I32 ocnt, U32 flags).Ve.SH "Functions in file pp_ctl.c".IX Header "Functions in file pp_ctl.c".IP "find_runcv" 8.IX Xref "find_runcv".IX Item "find_runcv"Locate the \s-1CV\s0 corresponding to the currently executing sub or eval.If db_seqp is non_null, skip CVs that are in the \s-1DB\s0 package and populate*db_seqp with the cop sequence number at the point that the \s-1DB::\s0 code wasentered. (allows debuggers to eval in the scope of the breakpoint ratherthan in the scope of the debugger itself)..Sp.Vb 1\& CV* find_runcv(U32 *db_seqp).Ve.SH "Functions in file pp_pack.c".IX Header "Functions in file pp_pack.c".IP "packlist" 8.IX Xref "packlist".IX Item "packlist"The engine implementing \fIpack()\fR Perl function..Sp.Vb 1\& void packlist(SV *cat, const char *pat, const char *patend, SV **beglist, SV **endlist).Ve.IP "unpackstring" 8.IX Xref "unpackstring".IX Item "unpackstring"The engine implementing \fIunpack()\fR Perl function. \f(CW\*(C`unpackstring\*(C'\fR puts theextracted list items on the stack and returns the number of elements.Issue \f(CW\*(C`PUTBACK\*(C'\fR before and \f(CW\*(C`SPAGAIN\*(C'\fR after the call to this function..Sp.Vb 1\& I32 unpackstring(const char *pat, const char *patend, const char *s, const char *strend, U32 flags).Ve.SH "GV Functions".IX Header "GV Functions".IP "GvSV" 8.IX Xref "GvSV".IX Item "GvSV"Return the \s-1SV\s0 from the \s-1GV\s0..Sp.Vb 1\& SV* GvSV(GV* gv).Ve.IP "gv_const_sv" 8.IX Xref "gv_const_sv".IX Item "gv_const_sv"If \f(CW\*(C`gv\*(C'\fR is a typeglob whose subroutine entry is a constant sub eligible forinlining, or \f(CW\*(C`gv\*(C'\fR is a placeholder reference that would be promoted to sucha typeglob, then returns the value returned by the sub. Otherwise, returns\&\s-1NULL\s0..Sp.Vb 1\& SV* gv_const_sv(GV* gv).Ve.IP "gv_fetchmeth" 8.IX Xref "gv_fetchmeth".IX Item "gv_fetchmeth"Returns the glob with the given \f(CW\*(C`name\*(C'\fR and a defined subroutine or\&\f(CW\*(C`NULL\*(C'\fR. The glob lives in the given \f(CW\*(C`stash\*(C'\fR, or in the stashesaccessible via \f(CW@ISA\fR and \s-1UNIVERSAL::\s0..SpThe argument \f(CW\*(C`level\*(C'\fR should be either 0 or \-1. If \f(CW\*(C`level==0\*(C'\fR, as aside-effect creates a glob with the given \f(CW\*(C`name\*(C'\fR in the given \f(CW\*(C`stash\*(C'\fRwhich in the case of success contains an alias for the subroutine, and setsup caching info for this glob..SpThis function grants \f(CW"SUPER"\fR token as a postfix of the stash name. The\&\s-1GV\s0 returned from \f(CW\*(C`gv_fetchmeth\*(C'\fR may be a method cache entry, which is notvisible to Perl code. So when calling \f(CW\*(C`call_sv\*(C'\fR, you should not usethe \s-1GV\s0 directly; instead, you should use the method's \s-1CV\s0, which can beobtained from the \s-1GV\s0 with the \f(CW\*(C`GvCV\*(C'\fR macro..Sp.Vb 1\& GV* gv_fetchmeth(HV* stash, const char* name, STRLEN len, I32 level).Ve.IP "gv_fetchmethod_autoload" 8.IX Xref "gv_fetchmethod_autoload".IX Item "gv_fetchmethod_autoload"Returns the glob which contains the subroutine to call to invoke the methodon the \f(CW\*(C`stash\*(C'\fR. In fact in the presence of autoloading this may be theglob for \*(L"\s-1AUTOLOAD\s0\*(R". In this case the corresponding variable \f(CW$AUTOLOAD\fR isalready setup..SpThe third parameter of \f(CW\*(C`gv_fetchmethod_autoload\*(C'\fR determines whether\&\s-1AUTOLOAD\s0 lookup is performed if the given method is not present: non-zeromeans yes, look for \s-1AUTOLOAD\s0; zero means no, don't look for \s-1AUTOLOAD\s0.Calling \f(CW\*(C`gv_fetchmethod\*(C'\fR is equivalent to calling \f(CW\*(C`gv_fetchmethod_autoload\*(C'\fRwith a non-zero \f(CW\*(C`autoload\*(C'\fR parameter..SpThese functions grant \f(CW"SUPER"\fR token as a prefix of the method name. Notethat if you want to keep the returned glob for a long time, you need tocheck for it being \*(L"\s-1AUTOLOAD\s0\*(R", since at the later time the call may load adifferent subroutine due to \f(CW$AUTOLOAD\fR changing its value. Use the globcreated via a side effect to do this..SpThese functions have the same side-effects and as \f(CW\*(C`gv_fetchmeth\*(C'\fR with\&\f(CW\*(C`level==0\*(C'\fR. \f(CW\*(C`name\*(C'\fR should be writable if contains \f(CW\*(Aq:\*(Aq\fR or \f(CW\*(Aq\&\*(Aq\*(Aq\fR. The warning against passing the \s-1GV\s0 returned by \f(CW\*(C`gv_fetchmeth\*(C'\fR to\&\f(CW\*(C`call_sv\*(C'\fR apply equally to these functions..Sp.Vb 1\& GV* gv_fetchmethod_autoload(HV* stash, const char* name, I32 autoload).Ve.IP "gv_fetchmeth_autoload" 8.IX Xref "gv_fetchmeth_autoload".IX Item "gv_fetchmeth_autoload"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -