From: Richard W.M. Jones Date: Sun, 24 Jan 2016 17:19:07 +0000 (+0000) Subject: Document use of mexp_get_pcre_error when calling pcre_get_substring. X-Git-Tag: v1.1~11 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=ae18d42ca10e1548605014ca7fbf5a82e48c540f;p=miniexpect.git Document use of mexp_get_pcre_error when calling pcre_get_substring. virt-p2v uses this, and it surprised me as well. --- diff --git a/miniexpect.pod b/miniexpect.pod index baca020..e27a4cc 100644 --- a/miniexpect.pod +++ b/miniexpect.pod @@ -110,7 +110,7 @@ B B -Get and set the timeout used by C (see below). The +Get and set the timeout used by C [see below]. The resolution is milliseconds (1/1000th of a second). Set this before calling C. Passing -1 to either of the C methods means no timeout. The default setting is 60000 milliseconds (60 @@ -125,10 +125,32 @@ The default is 1024. Most callers will not need to change this. B +When C [see below] calls the PCRE function +L, it stashes the return value in the C +field in the handle, and that field is returned by this method. + +There are two uses for this: + +=over 4 + +=item 1. + If C returns C, then the actual PCRE error code returned by L is available by calling this method. For a list of PCRE error codes, see L. +=item 2. + +A more unusual use is if you ever need to get the captured substrings +from your regular expression (calling L). The +third parameter of that function (C) is the value +returned by L, and so you can call it like this: + + pcre_get_substring (h->buffer, ovector, + mexp_get_pcre_error (h), 1, &matched); + +=back + The following fields in the handle do not have methods, but can be accessed directly instead: