Skip to content

Commit 525e984

Browse files
committed
Modified module examples to work as indicated
In the MyModule example, the stubbed class and sub caused an error when called. Modified the MakeQuestionable example to match the output text (used join on list to provide the spaces).
1 parent b3bf11d commit 525e984

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

doc/Language/modules.pod6

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -295,27 +295,27 @@ the values are the desired values. The names should include the sigil
295295
=begin code :skip-test
296296
# lib/MyModule.pm
297297
298-
class MyModule::Class { ... }
298+
class MyModule::Class { }
299299
300300
sub EXPORT {
301-
{
302-
'$var' => 'one',
303-
'@array' => <one two three>,
304-
'%hash' => { one => 'two', three => 'four' },
305-
'&doit' => sub { ... },
306-
'ShortName' => MyModule::Class
307-
}
301+
%(
302+
'$var' => 'one',
303+
'@array' => <one two three>,
304+
'%hash' => %( one => 'two', three => 'four' ),
305+
'&doit' => sub { say 'Greetings from exported sub' },
306+
'ShortName' => MyModule::Class
307+
)
308308
}
309309
=end code
310310
311311
=begin code :skip-test
312312
# main.pl
313313
use lib 'lib';
314314
use MyModule;
315-
say $var;
316-
say @array;
317-
say %hash;
318-
doit();
315+
say $var; # OUTPUT: «one␤»
316+
say @array; # OUTPUT: «(one two three)␤»
317+
say %hash; # OUTPUT: «{one => two, three => four}␤»
318+
doit(); # OUTPUT: «Greetings from exported sub␤»
319319
say ShortName.new; # OUTPUT: «MyModule::Class.new␤»
320320
=end code
321321
@@ -350,7 +350,8 @@ passing C<:DEFAULT> to C<use> along with your positional parameters.
350350
# main.pl
351351
use lib 'lib';
352352
use MyModule 'foo';
353-
say foo.new(); # MyModule::Class.new
353+
say foo.new(); # OUTPUT: «MyModule::Class.new␤»
354+
354355
always(); # OK - is imported
355356
shy(); # FAIL - won't be imported
356357
=end code
@@ -371,7 +372,7 @@ L<Cool>s.
371372
372373
=begin code :skip-test
373374
use MakeQuestionable Cool;
374-
say 0?, 1?, {}?, { a => "b" }?; # OUTPUT: «False True False True␤»
375+
say ( 0?, 1?, {}?, %( a => "b" )? ).join(' '); # OUTPUT: «False True False True␤»
375376
=end code
376377
377378
=head2 Introspection

0 commit comments

Comments
 (0)