Skip to content

Commit 37bb2e7

Browse files
committed
Merge branch 'master' of github.com:perl6/doc
2 parents 74fd84f + 26e5b69 commit 37bb2e7

File tree

12 files changed

+145
-88
lines changed

12 files changed

+145
-88
lines changed

Build.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Since the p6doc pod is now moved from 'lib' to 'doc' in the distribution we
2-
# need this to install pod in the usual place (under 'lib' as a target).
2+
# need this to install pod under .../share/perl6/doc
33
# This fixes p6doc command line use.
44

55
use Panda::Common;
@@ -11,7 +11,7 @@ use Panda::Installer;
1111
class Build is Panda::Builder {
1212
method build($workdir) {
1313

14-
my $dest-pref = Panda::Installer.new.default-prefix() ~ '/lib/';
14+
my $dest-pref = Panda::Installer.new.default-prefix() ~ '/../doc';
1515

1616
my @files = find(dir => "$workdir/doc", type => 'file').list;
1717

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@ help:
2323
run:
2424
@echo "Starting local server…"
2525
perl app.pl daemon
26+
27+
clean:
28+
rm -rf html/*.html html/.*.html html/routine/ html/type/ html/op/ html/language/ html/syntax/ html/images/type-graph* html/js/search.js
29+

bin/p6doc

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env perl6
22
use MONKEY-SEE-NO-EVAL; # until we have a better serialisation
33

4+
my $PROGRAM-NAME="p6doc";
5+
46
# die with printing a backtrace
57
my class X::P6doc is Exception {
68
has $.message;
@@ -28,8 +30,8 @@ sub tempfile() {
2830
}
2931

3032
sub search-paths() {
31-
((findbin() X~ <../doc/perl6/lib/ ../lib/> X~ <Type/ Language/ Routine/>).list,
32-
@*INC.map({CompUnitRepo.new($_)})».IO».Str.map({ /\/$/ ?? $_ !! $_ ~ '/' }).list).flat.list;
33+
# XXX we need a way of getting inline pod from installed modules too
34+
($*REPO.repo-chain()>>.Str X~ </doc/>).grep: *.IO.d
3335
}
3436

3537
sub module-names(Str $modulename) {
@@ -38,7 +40,9 @@ sub module-names(Str $modulename) {
3840
}
3941

4042
sub locate-module(Str $modulename) {
41-
my $m = (search-paths() X~ module-names($modulename).list).first: *.IO.f;
43+
my @candidates = (search-paths() X~ module-names($modulename).list);
44+
DEBUG and warn :@candidates.perl;
45+
my $m = @candidates.first: *.IO.f;
4246
unless $m.defined {
4347
my $message = join "\n",
4448
"Cannot locate $modulename in any of the following paths:",
@@ -68,7 +72,7 @@ sub show-docs(Str $path, :$section) {
6872
}
6973

7074
multi sub MAIN() {
71-
my $me = $*PROGRAM-NAME.IO.basename;
75+
my $me = $PROGRAM-NAME.IO.basename;
7276

7377
say 'What documentation do you want to read?';
7478
say "Examples: $me Type::Str";
@@ -81,7 +85,7 @@ multi sub MAIN() {
8185
multi sub MAIN($docee) {
8286
return MAIN($docee, :f) if defined $docee.index('.') ;
8387
if INDEX.IO ~~ :e {
84-
my %data = EVAL slurp INDEX;
88+
my %data = EVALFILE INDEX;
8589
if %data{$docee} {
8690
my $newdoc = %data{$docee}[0][0];
8791
return MAIN($newdoc);
@@ -95,7 +99,7 @@ multi sub MAIN($docee, Bool :$f!) {
9599
if ! $method {
96100
my %hits;
97101
if INDEX.IO ~~ :e {
98-
my %data = EVAL slurp INDEX;
102+
my %data = EVALFILE INDEX;
99103

100104
my $final-docee = disambiguate-f-search( $docee, %data );
101105
($package, $method) = $final-docee.split('.');
@@ -105,7 +109,7 @@ multi sub MAIN($docee, Bool :$f!) {
105109
} else {
106110
say 'In order to use unqualified sub and method names like "p6doc -f say"';
107111
say 'you will need to run "p6doc-index build" to build index.data.';
108-
say 'Otherwise use "p6doc -f Str.split" instead of "p6doc -f split" for now.';
112+
say 'Otherwise use "p6doc -f Type::Str.split" instead of "p6doc -f split" for now.';
109113
exit 2;
110114
}
111115
} else {

bin/p6doc-index

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,15 @@ multi sub MAIN('path-to-index') {
2727
multi sub MAIN('build') {
2828
my %words;
2929

30-
# XXX p6doc probably uses another path to @*INC which is probably incomplete
31-
32-
for @*INC.map({CompUnitRepo.new($_)})».IO -> $lib_path is copy {
33-
next unless $lib_path.e;
34-
35-
$lib_path = $lib_path.Str;
30+
# XXX should index more than this
31+
for ($*REPO.repo-chain()>>.Str X~ </doc/>).grep: *.IO.d -> $lib_path is copy {
3632
my @files = find(:dir($lib_path),:type('file')).map({.IO});
3733

3834
for @files -> $f {
3935
my $file = $f.path;
4036
next if $file !~~ /\.pod$/;
4137
my $pod = substr($file.Str, 0 , $file.Str.chars -4);
42-
$pod.=subst(/$lib_path\//,"");
38+
$pod.=subst($lib_path,"");
4339
$pod.=subst(/\//,'::',:g);
4440
my $section = '';
4541
for open( $file.Str).lines -> $row {

doc/Language/5to6-nutshell.pod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ Perl modules is C<PERL5LIB>.
11031103
11041104
$ PERL5LIB="/some/module/lib" perl program.pl
11051105
1106-
In Perl6 this is similar, one merely needs to change a number! As you
1106+
In Perl 6 this is similar, one merely needs to change a number! As you
11071107
probably guessed, you just need to use C<PERL6LIB>:
11081108
11091109
$ PERL6LIB="/some/module/lib" perl6 program.p6
@@ -1113,10 +1113,10 @@ library path within the program via the C<use lib> pragma:
11131113
11141114
use lib '/some/module/lib'
11151115
1116-
Note that C<PERL6LIB> is more of a developer convenience in Perl6 (as
1116+
Note that C<PERL6LIB> is more of a developer convenience in Perl 6 (as
11171117
opposed to the equivalent usage of C<PERL5LIB> in Perl5) and shouldn't be
11181118
used by module consumers as it could be removed in the future. This is
1119-
because Perl6's module loading isn't directly compatible with operating
1119+
because Perl 6's module loading isn't directly compatible with operating
11201120
system paths.
11211121
11221122
=head2 Misc.
@@ -1220,7 +1220,7 @@ statement:
12201220
12211221
In order to get this to work, one obviously has to jump through many hoops.
12221222
In the standard use-case where one specifies the functions to be exported
1223-
via the C<is export> role, Perl6 automatically creates the C<EXPORT> sub in
1223+
via the C<is export> role, Perl 6 automatically creates the C<EXPORT> sub in
12241224
the correct manner for you, so one should consider very carefully whether or
12251225
not writing one's own C<EXPORT> routine is worthwhile.
12261226
@@ -1374,7 +1374,7 @@ your MAD science experiments.
13741374
13751375
Jeff Goff's Perl::ToPerl6 module for Perl 5 is designed around
13761376
Perl::Critic's framework. It aims to convert Perl5 to compilable (if not
1377-
necessarily running) Perl6 code with the bare minimum of changes. Code
1377+
necessarily running) Perl 6 code with the bare minimum of changes. Code
13781378
transformers are configurable and pluggable, so you can create and
13791379
contribute your own transformers, and customize existing transformers to
13801380
your own needs. You can install the latest release from CPAN, or follow
@@ -1383,7 +1383,7 @@ some point.
13831383
13841384
=head2 Other sources of translation knowledge
13851385
1386-
=item L<http://perlgeek.de/en/article/5-to-6>
1386+
=item L<https://perlgeek.de/en/article/5-to-6>
13871387
=item L<https://github.com/Util/Blue_Tiger/>
13881388
=item L<https://perl6advent.wordpress.com/2011/12/23/day-23-idiomatic-perl-6/>
13891389
=item L<http://www.perlfoundation.org/perl6/index.cgi?perl_6_delta_tablet>

0 commit comments

Comments
 (0)