Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
EXPORT can take arguments
  • Loading branch information
gfldex committed Jan 13, 2016
1 parent 80deb58 commit 2e7d8de
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions doc/Language/modules.pod
Expand Up @@ -283,6 +283,23 @@ passing C<:DEFAULT> to C<use> along with your positional parameters.
shy(); #FAIL - won't be imported
=end code
C<EXPORT> can take arguments, given it was provided with a signature. Type
captures are supported.
# lib/MyModule.pm
sub EXPORT(Int $i = 42) {
{
'foo' => sub () { $i }
}
}
# main.pl
use MyModule 666;
foo(); # 666
=head1 Distributing Modules
If you've written a Perl 6 module and would like to share it with the
Expand Down

0 comments on commit 2e7d8de

Please sign in to comment.