Last active
June 21, 2019 22:05
-
-
Save treyharris/eba1752c6a59a17fb570dbfbfb236ef0 to your computer and use it in GitHub Desktop.
The minimal working CLI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl6 | |
## To get a MAIN to run in a unit module/package: | |
unit module My-Modules-Script; | |
## You must have the `is export` here; `our` will not work | |
sub MAIN($x) is export { | |
say "This is the module's MAIN called with $x"; | |
} | |
## And you must call it differently: | |
# $ ./My-Modules-Script.pm6 | |
# $ ./My-Modules-Script.pm6 22 | |
# $ perl6 -M My-Modules-Script -e '' | |
# Usage: | |
# -e '...' <x> | |
# $ perl6 -M My-Modules-Script -e '' 42 | |
# This is the module's MAIN called with 42 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment