Skip to content

Commit 2e7d8de

Browse files
committed
EXPORT can take arguments
1 parent 80deb58 commit 2e7d8de

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
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

0 commit comments

Comments
 (0)