develooper Front page | perl.perl6.users | Postings from October 2018

Accessing CompUnit

Richard Hainsworth
October 25, 2018 16:31
Accessing CompUnit
Message ID:

(I am cross-posting this to stackoverflow #perl6 as well)

I am trying to create a cache of POD6 by precompiling them using the 
CompUnit set of classes.

I can create, store and retrieve pod as follows:


use v6.c;
use nqp;
my $precomp-store =>'cache'.IO);
my $precomp => 
$precomp-store );

my $key = nqp::sha1('test.pod6');
=begin pod
=TITLE More and more

Some more text

=end pod

$precomp.precompile('test.pod6'.IO, $key, :force);

my $handle = $precomp.load($key, )[0];

my $resurrected = nqp::atkey($handle.unit,'$=pod')[0];

say $resurrected ~~ Pod::Block::Named;


This produces the output `True`.

However, if I want to run another program that accesses the CompUnit, 
how do I re-establish the link with the CompUnit without over-writing 
previous content?

Richard Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About