Skip to content

Commit

Permalink
Update the tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
ingydotnet committed Dec 5, 2014
1 parent e39b5f7 commit 886be03
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions doc/Inline/Module/Tutorial.swim
Expand Up @@ -78,16 +78,14 @@ right magics.

== The Inline Stub Module

Next you'll need to actually generate the stub module. You only need to do
this once. Run this command:
Next you'll need to actually generate the stub module. Run this command:

perl -MInline::Module=blib Acme::Math::XS -e1
perl -MInline::Module=makestub,Acme::Math::XS::Inline

You'll get a `blib/lib/Acme/Math/XS/Inline.pm` that looks like this:
You'll get a `lib/Acme/Math/XS/Inline.pm` that looks like this:

use strict; use warnings;
package Acme::Math::XS::Inline;
use base 'Inline';
use Inline::Module 'v1' => '1.23';
1;

Expand All @@ -110,14 +108,31 @@ extension libraries. As long the shared library stuff gets built into the

== Automatic Stub Generation

# TODO
If you don't want to keep the generated stub code around, there is a way to
have it autogenerated. Just set `PERL5OPT` like this:

export PERL5OPT='-MInline::Module=autostub'

This will add a CODE ref to @INC that will generate stub modules just in time,
and put them under `lib`. For instance if you just run your tests with:

prove -l t/

the stub modules will be autogenerated. If you'd rather see the stubs be
generated under the `blib` directory, use this:

export PERL5OPT='-MInline::Module=autostub,blib'

Then you'll need to add the `-b` flag for testing:

prove -lb t/

== Testing

There are a few ways to test stuff and I'll describe them here. They should be
familiar to most module authors.

- `prove -lv t/`
- `prove -l t/`

This is the easiest and most common method of testing for *non*-XS module
authors. Since Inline is involved, the compilation steps just work.
Expand All @@ -131,7 +146,7 @@ familiar to most module authors.

You can also use the XS style. It all works out the same.

- `prove -bv t/`
- `prove -b t/`

In this style, you are just invoking the `blib` results directly, and Inline
is not involved. Use this if you want to know that no nothing is up a
Expand Down

0 comments on commit 886be03

Please sign in to comment.