Skip to content

Commit 94561f4

Browse files
committed
perlclass: document the unit-class statement form
1 parent 917e6a8 commit 94561f4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pod/perlclass.pod

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ the scope of current package:
4949

5050
class NAME VERSION BLOCK
5151

52+
class NAME;
53+
54+
class NAME VERSION;
55+
5256
The C<class> keyword declares a new package which is intended to be a class.
5357
All other keywords from the C<class> feature should be used in scope of this
5458
declaration.
@@ -57,6 +61,11 @@ declaration.
5761
# class definition goes here
5862
}
5963

64+
Classes can be declared in either block or statement syntax. If a block is
65+
used, the body of the block contains the implementation of the class. If the
66+
statement form is used, the remainder of the file is used up until the next
67+
C<class> or C<package> statement.
68+
6069
C<class> and C<package> declarations are similar, but classes automatically get
6170
a constructor named C<new> - You don't have to (and should not) write one.
6271
Additionally, in the class BLOCK you are allowed to declare fields and methods.

0 commit comments

Comments
 (0)