Skip to content

Instantly share code, notes, and snippets.

@jnthn
Created March 12, 2010 10:24
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 jnthn/330215 to your computer and use it in GitHub Desktop.
Save jnthn/330215 to your computer and use it in GitHub Desktop.
.sub 'main'
# Load Perl 5 interpreter interop layer.
load_bytecode 'perl5.pbc'
say "Loaded"
$P0 = compreg 'perl5'
say "Got compiler"
# Try to load CGI.pm.
$P1 = new ['ResizablePMCArray']
push $P1, 'CGI'
$P2 = $P0.'load_library'($P1)
$P2 = $P2['namespace']
say "Loaded CGI"
# Try to call a package method.
$P3 = $P2.'new'()
say "Created new object"
# OH NOES HALP! After here we segfault.
$S0 = $P3.'header'()
say $S0
say "Survived"
.end
.sub 'main'
# Load Perl 5 interpreter interop layer.
load_bytecode 'perl5.pbc'
say "Loaded"
$P0 = compreg 'perl5'
say "Got compiler"
# Try to load CGI.pm.
$P1 = new ['ResizablePMCArray']
push $P1, 'CGI'
$P2 = $P0.'load_library'($P1)
$P2 = $P2['namespace']
say "Loaded CGI"
# Try to call a package method.
$S0 = $P2.'header'()
say $S0
.end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment