Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed misstatement about packages and 'is export'
  • Loading branch information
LLFourn committed Oct 8, 2015
1 parent 19c6a84 commit 851cf02
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/Language/modules.pod
Expand Up @@ -62,19 +62,22 @@ exported available in the current lexical scope.
=head2 Exporting and Selective Importing
Subroutines, variables, constants and enums are exported by marking
Packages, subroutines, variables, constants and enums are exported by marking
them with the L<is export> trait.
=begin code
unit module MyModule;
our $var is export = 3;
sub foo is export { ... };
constant $FOO is export = "foobar";
enum FooBar is export (:baz(1));
enum FooBar is export <one two three>;
#'is export' is not for packages
class MyModule::Class {}
=end code
# Packages like classes can be exported too
class MyClass is export {};
# If a subpackage is in the namespace of the current package
# it doesn't need to be explicitly exported
class MyModule::MyClass {};
You can pass parameters to C<is export> to group symbols for exporting
then the importer can pick and choose. There are three predefined
Expand All @@ -93,11 +96,11 @@ tags: C<ALL>, C<DEFAULT> and C<MANDATORY>.
=begin code
# main.pl
use lib 'lib';
use MyModule; #pants, bag
use MyModule; #bag, pants
use MyModule :DEFAULT; #the same
use MyModule :day; #pants, sunglasses
use MyModule :night; #pants, torch
use MyModule :ALL; #pants, sunglasses, torch, underpants
use MyModule :ALL; #bag, pants, sunglasses, torch, underpants
=end code
=head2 EXPORT
Expand Down

0 comments on commit 851cf02

Please sign in to comment.