X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlembed.pod;h=ea0e8331f2f2127f6e177ce12e3279fad95c4e16;hb=3ed26a2c26e4f1468588c483e9e86eae4e74f24f;hp=646cd670a19daea85d0d1bfec5ece25d7a6267c3;hpb=96dbc785049371b8845893bf40bd39d4db026518;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlembed.pod b/pod/perlembed.pod index 646cd67..ea0e833 100644 --- a/pod/perlembed.pod +++ b/pod/perlembed.pod @@ -16,12 +16,12 @@ Read L and L. =item B -Read about backquotes and L and L. +Read about back-quotes and about C and C in L. =item B -Read about L and L and L -and L. +Read about C and C in L and L and C +and C in L and L, L. =item B @@ -142,7 +142,7 @@ I containing the essentials of embedding: Note that we do not use the C pointer here or in any of the following examples. -Normally handed to C as it's final argument, +Normally handed to C as its final argument, we hand it a B instead, in which case the current environment is used. @@ -226,7 +226,7 @@ L =head2 Evaluating a Perl statement from your C program NOTE: This section, and the next, employ some very brittle techniques -for evaluting strings of Perl code. Perl 5.002 contains some nifty +for evaluating strings of Perl code. Perl 5.002 contains some nifty features that enable A Better Way (such as with L). Look for updates to this document soon. @@ -236,7 +236,7 @@ ours I) that wraps around Perl's L. Arguably, this is the only routine you'll ever need to execute snippets of Perl code from within your C program. Your string can be as long as you wish; it can contain multiple statements; it can -use L or L to include external Perl +use L or L to include external Perl files. Our I lets us evaluate individual Perl strings, and then @@ -303,14 +303,14 @@ substitutions: I, I, and I. char match(char *string, char *pattern); -Given a string and a pattern (e.g. "m/clasp/" or "/\b\w*\b/", which in +Given a string and a pattern (e.g., "m/clasp/" or "/\b\w*\b/", which in your program might be represented as C<"/\\b\\w*\\b/">), returns 1 if the string matches the pattern and 0 otherwise. int substitute(char *string[], char *pattern); -Given a pointer to a string and an "=~" operation (e.g. "s/bob/robert/g" or +Given a pointer to a string and an "=~" operation (e.g., "s/bob/robert/g" or "tr[A-Z][a-z]"), modifies the string according to the operation, returning the number of substitutions made. @@ -488,9 +488,9 @@ described in L. Once you've understood those, embedding Perl in C is easy. -Since C has no built-in function for integer exponentiation, let's +Because C has no built-in function for integer exponentiation, let's make Perl's ** operator available to it (this is less useful than it -sounds, since Perl implements ** with C's I function). First +sounds, because Perl implements ** with C's I function). First I'll create a stub exponentiation function in I: sub expo { @@ -612,7 +612,7 @@ counterpart for each of the extension's XSUBs. Don't worry about this part; leave that to the I and extension authors. If your extension is dynamically loaded, DynaLoader creates I for you on the fly. In fact, if you have a working DynaLoader then there -is rarely any need to statically link in any other extensions. +is rarely any need to link in any other extensions statically. Once you have this code, slap it into the second argument of I: @@ -644,7 +644,7 @@ Consult L and L for more details. =head1 MORAL You can sometimes I in C, but -you can always I in Perl. Since you can use +you can always I in Perl. Because you can use each from the other, combine them as you wish.