File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -714,6 +714,19 @@ as the target type. So you can define coercions for your own types like so:
714
714
Coercion types are supposed to work wherever types work, but Rakudo
715
715
currently (2015.02) only implements them for subroutine parameters.
716
716
717
+ = head1 C < sub MAIN >
718
+
719
+ The sub with the special name C < MAIN > is executed after all relevant phaser
720
+ and it's signature is the means by which command line arguments can be parsed.
721
+ Multi methods are supported and a usage method is automatically generated and
722
+ displayed if no command line arguments are provided.
723
+
724
+ sub MAIN ( Int :$length = 24, :file($data) = 'file.dat', Bool :$verbose ) {
725
+ say $length if $length.defined;
726
+ say $data if $data.defined;
727
+ say 'Verbosity ', ($verbose ?? 'on' !! 'off');
728
+ }
729
+
717
730
= end pod
718
731
719
732
# vim: expandtab shiftwidth=4 ft=perl6
You can’t perform that action at this time.
0 commit comments