Skip to content

Commit 26c1b4a

Browse files
author
Tadeusz Sośnierz
committed
Added an initial version of today's article
1 parent 1df8466 commit 26c1b4a

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
=head1 Writing the Perl 6 modules
2+
3+
The Perl 6 module database on L<http://modules.perl6.org> is certainly
4+
not CPAN yet, but there are still a number of things worth using, or
5+
at least knowing about. There's no "standard" module installer for
6+
Perl 6, like there's a cpan shell for Perl 5, but the most commonly used
7+
and most often working is L<neutro|https://github.com/tadzik/neutro>.
8+
It's a simple script fetching, building, and installing modules from
9+
L<the ecosystem|https://github.com/perl6/ecosystem>, resolving
10+
dependencies and checking if the tests are passing: not much more we
11+
need. Let's see how to install something interesting with it, say
12+
L<JSON::Tiny|https://github.com/moritz/json/>, a JSON parser.
13+
14+
First, we need to get neutro. We will assume you use git to obtain it;
15+
notice that git is also obligatory to download modules (all of them
16+
live on github currently).
17+
18+
git clone git://github.com/tadzik/neutro.git
19+
cd neutro
20+
PERL6LIB=tmplib bin/neutro .
21+
22+
That will download neutro and bootstrap it using the supplied libs.
23+
What we end up is the module installer itself, and the File::Tools and
24+
Module::Tools distributions. From now on, assuming C<~/.perl6/bin> is in
25+
your PATH and C<~/.perl6/lib> is in your PERL6LIB (check your
26+
C<~/.profile> or C<~/.bashrc> to be sure), you will be able to install
27+
modules as simply as with cpanminus:
28+
29+
neutro json
30+
neutro perl6-Term-ANSIColor
31+
neutro perl6-lwp-simple
32+
33+
You may notice module names are not similar to what you may be used to
34+
from Perl 5. They're not standarized, they're just the names of a git
35+
repos they live in. To make sure what you are looking for, consult the
36+
list:
37+
38+
neutro update # fetch the fresh list of modules
39+
neutro list
40+
41+
Modules will be installed to C<~/.perl6/lib> as well, so assuming your
42+
PERL6LIB is alredy set, you are now able to use the installed modules:
43+
44+
perl6 -e 'use Term::ANSIColor; say colored("Hello blue world!", "blue")'
45+
46+
=head2 The module ecosystem
47+
48+
You probably just can't wait to write your first module and make it
49+
available for the whole world. There's no CPAN where you can send your
50+
packages; the usual workflow is creating a repository on L<Github|http://github.com> and adding it to the L<projects.list|https://github.com/perl6/ecosystem/blob/master/projects.list>
51+
file in the L<ecosystem|https://github.com/perl6/ecosystem>. You don't
52+
need to have a direct access to the repo to get your module published.
53+
You can either send a pull request for your forked ecosystem repo,
54+
send a patch, or just ask some of the commiters or people on the #perl6
55+
channel of Freenode.
56+
57+
TBD: Link to module writing guide, anything else?

0 commit comments

Comments
 (0)