Hi,

(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:

<code>

use v6.c;
use nqp;
my $precomp-store = CompUnit::PrecompilationStore::File.new(prefix=>'cache'.IO); my $precomp = CompUnit::PrecompilationRepository::Default.new(store=> $precomp-store );

my $key = nqp::sha1('test.pod6');
'test.pod6'.IO.spurt(q:to/CONTENT/);
=begin pod
=TITLE More and more

Some more text

=end pod
CONTENT

$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;

</code>

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

Reply via email to