Skip to content

Commit a7aa693

Browse files
committed
Merge pull request #346 from gfldex/master
EXPORT can take arguments | fix link
2 parents c4076e8 + 2e7d8de commit a7aa693

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

doc/Language/modules.pod

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,23 @@ passing C<:DEFAULT> to C<use> along with your positional parameters.
283283
shy(); #FAIL - won't be imported
284284
=end code
285285
286+
C<EXPORT> can take arguments, given it was provided with a signature. Type
287+
captures are supported.
288+
289+
# lib/MyModule.pm
290+
291+
sub EXPORT(Int $i = 42) {
292+
{
293+
'foo' => sub () { $i }
294+
}
295+
}
296+
297+
# main.pl
298+
299+
use MyModule 666;
300+
301+
foo(); # 666
302+
286303
=head1 Distributing Modules
287304
288305
If you've written a Perl 6 module and would like to share it with the

doc/Type/Mu.pod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ Marks a type as being exported, that is, available to external users.
251251
A user of a module or class automatically gets all the symbols imported that
252252
are marked as C<is export>.
253253
254-
See L</language/modules#Exporting and Selective Importing> for more details.
254+
See L</language/modules#Exporting_and_Selective_Importing> for more details.
255255
256256
=head2 method take
257257

0 commit comments

Comments
 (0)