I figure it's about time for Parrot programs to be able to look at Parrot's configuration, so I'm trying to implement a library equivalent to Parrot::Config. My current thoughts on implementation involve three elements:

  1.  A Configure step that writes and executes a Parrot program. Said
      program builds up a PerlHash of options and freezes it to disk.
  2.  Said frozen hash, stored in (e.g.) F<library/config.fpmc>.
  3.  A small chunk of code in (e.g.) F<library/config.imc> which reads
      the frozen hash from disk and re-creates it.

This would guarantee that you're seeing the configuration info for the current system, even if you moved a bytecode file with config.imc compiled into it.

Unfortunately, I'm being stopped before I can even start. The following code prints "foo=" on my Debian server:

        new P0, .PerlString
        set P0, "foo"

        freeze S0, P0
        thaw P1, S0

        print P0
        print "="
        print P1
        print "\n"

end

If I freeze a hash, the keys are preserved, but string values are lost. Integer values are kept; float values all come out as 0.0 (plus or minus about eight zeros).

F<t/pmc/freeze.t> doesn't test freezing and thawing strings or floats. Is this because the functionality hasn't been implemented yet? A cursory examination of F<src/pmc_freeze.c> suggests that it should be working, but I may well be missing something.

If it's just some busywork, such as copying some code into PerlString and tweaking it, I can probably do it, but I've been out of the loop for a while, so anything particularly involved is likely beyond me.

--
Brent "Dax" Royal-Gordon <[EMAIL PROTECTED]>
Perl and Parrot hacker

Oceania has always been at war with Eastasia.

Reply via email to