Skip to content

Instantly share code, notes, and snippets.

@Scimon
Created November 11, 2019 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Scimon/b589a25527b46e591e931287bcea8089 to your computer and use it in GitHub Desktop.
Save Scimon/b589a25527b46e591e931287bcea8089 to your computer and use it in GitHub Desktop.
Simple Exmaple on plugins to MAIN sub
module Doubler {
sub doubler ( Cool() $x ) { $x *2 }
#| Doubles the given value
multi sub MAIN( "double", Cool() $x ) is export(:main) {
say "double( {$x} ) => {doubler($x)}";
}
}
#!/usr/bin/perl6
use v6;
use Doubler :main;
#| Various numeric operations
multi sub MAIN( Bool :h(:$help) where so * ) {
say $*USAGE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment