Skip to content

Commit 6bc83dd

Browse files
committed
prefer lowe-case name for example sub; some minor formatting tweaks
1 parent 400e3b2 commit 6bc83dd

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

lib/Language/nativecall.pod

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ routine in your library that may be different from your Perl subroutine name.
3939
4040
module Foo;
4141
use NativeCall;
42-
our sub Init() is native('libfoo') is symbol('FOO_INIT') { * }
42+
our sub init() is native('libfoo') is symbol('FOO_INIT') { * }
4343
4444
Inside of "libfoo" there is a routine called "FOO_INIT" but, since we're
45-
creating a module called Foo and we'd rather call the routine as Foo::Init,
45+
creating a module called Foo and we'd rather call the routine as C<Foo::init>,
4646
we use the "symbol" trait to specify the name of the symbol in "libfoo"
47-
and call the subroutine whatever we want ("Init" in this case).
47+
and call the subroutine whatever we want ("init" in this case).
4848
4949
=head1 Passing and Returning Values
5050
51-
Normal Perl 6 signatures and the "returns" trait are used in order to convey
51+
Normal Perl 6 signatures and the C<returns> trait are used in order to convey
5252
the type of arguments a native function expects and what it returns. Here is
5353
an example.
5454
@@ -69,8 +69,8 @@ likely grow with time).
6969
CArray[int32] (int* in C, an array of integers)
7070
Pointer[void] (void* in C, can point to all other types)
7171
72-
Note that the lack of a "returns" trait is used to indicate void return type.
73-
Do *not* use the 'void' type anywhere except in the Pointer parametrization.
72+
Note that the lack of a C<returns> trait is used to indicate void return type.
73+
Do I<not> use the 'void' type anywhere except in the Pointer parametrization.
7474
7575
For strings, there is an additional "encoded" trait to give some extra hints on
7676
how to do the marshalling.
@@ -145,10 +145,10 @@ Here is an example of passing a C array.
145145
@values[2] = 180.7e0;
146146
RenderBarChart('Weights (kg)', 3, @titles, @values);
147147
148-
Note that binding was used to @titles, *NOT* assignment! If you assign, you
148+
Note that binding was used to C<@titles>, I<not> assignment! If you assign, you
149149
are putting the values into a Perl 6 array, and it will not work out. If this
150-
all freaks you out, forget you ever knew anything about the "@" sigil and just
151-
use "$" all the way when using NativeCall. :-)
150+
all freaks you out, forget you ever knew anything about the C<@> sigil and just
151+
use C<$> all the way when using NativeCall. :-)
152152
153153
my $titles = CArray[Str].new;
154154
$titles[0] = 'Me';
@@ -199,7 +199,7 @@ the memory is not managed for you.
199199
200200
NativeCall currently doesn't put object members in containers, so assigning new values
201201
to them (with =) doesn't work. Instead, you have to bind new values to the private
202-
members: $!struct-member := StructObj.new;
202+
members: C<$!struct-member := StructObj.new;>
203203
204204
As you may have predicted by now, a null is represented by the type object of the
205205
struct type.
@@ -230,16 +230,21 @@ to callbacks.
230230
231231
TBD
232232
233-
=head1 Running the Examples
233+
=head1 Examples
234234
235-
The examples directory contains various examples of how to use NativeCall:
236-
L<http://github.com/jnthn/zavolaj/tree/master/examples>
235+
The L<zavolaj|https://github.com/jnthn/zavolaj> git repository (where NativeCall is
236+
developed) hosts L<various examples|https://github.com/jnthn/zavolaj/tree/master/examples>
237+
of how to use NativeCall.
237238
238-
More examples can be found in the lib/DBDish/ directory of the DBIsh repository
239-
at L<http://github.com/perl6/DBIish>.
239+
More examples can be found L<in the DBIsh repository
240+
|https://github.com/perl6/DBIish/tree/master/lib/DBDish>.
240241
241242
=head2 MySQL
242243
244+
=comment TODO Do we really need this here? Seems like this info should just go
245+
along-side that example in the git repo, rathern than replicated
246+
on p6doc.
247+
243248
There is an example of using the MySQL client library. There is a project
244249
L<http://github.com/mberends/minidbi> that wraps these functions with a DBI
245250
compatible interface. You'll need that library to hand; on Debian-esque systems

0 commit comments

Comments
 (0)