Skip to content

Instantly share code, notes, and snippets.

@mcandre
Last active August 29, 2015 14:19
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 mcandre/05d70f5871247078cb9b to your computer and use it in GitHub Desktop.
Save mcandre/05d70f5871247078cb9b to your computer and use it in GitHub Desktop.

ScriptedMain.pm:

#!/usr/bin/env perl6

module ScriptedMain {
  sub meaning_of_life is export {
    return 42;
  }
}

sub MAIN {
  import ScriptedMain;
  print "Main: The meaning of life is " ~ meaning_of_life() ~ "\n";
}

test.pl:

#!/usr/bin/env perl6

use lib '.';
use ScriptedMain;

print "Test: The meaning of life is " ~ meaning_of_life() ~ "\n";
$ ./ScriptedMain.pm 
Main: The meaning of life is 42

# ^ correct

$ ./test.pl 
Test: The meaning of life is 42

System:

$ specs perl6 os
Specs:

specs 0.14
https://github.com/mcandre/specs#readme

perl6 --version
This is perl6 version 2015.03 built on MoarVM version 2015.03

system_profiler SPSoftwareDataType | grep 'System Version'
      System Version: OS X 10.10.2 (14C1514)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment