Skip to content

Instantly share code, notes, and snippets.

@samuraisam
Last active December 18, 2015 21:29
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 samuraisam/5847807 to your computer and use it in GitHub Desktop.
Save samuraisam/5847807 to your computer and use it in GitHub Desktop.
use Hello;
thingy();
use PB 'omg.proto';
use PB::Grammar;
use PB::Actions;
module PB;
sub parse-idl-str($protofile) is export {
my $actions = PB::Actions.new();
my $result;
die "unable to parse file"
unless $result = PB::Grammar.parse($protofile, :actions($actions));
$result.ast;
}
sub parse-idl-file($filename) is export {
my $protofile = slurp(open $filename);
parse-idl-str($protofile);
}
our sub EXPORT(*@args) {
say "args: ", @args.perl;
EXPORT_SYMBOL('&thingy', [<ALL DEFAULT>], sub { say "hello" });
return {};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment