Alan Stewart wrote:
Also, this would be a nice time to implement the default value of PAR_CLEARTEMP in META.yml as you suggest in the notes in PAR.pm.
This would indeed by a nice time. How to read it from static.c/main.c will be a hurdle, though. I'll start with pure-perl implementation, then perhaps using the "magic string" approach in static.c/main.c to store extra variables, i.e. allocate some dummy strings to be later put to putenv().
If anyone can show me C code for reading embedded strings inside the executable, it will be appreciated. :-)
There are some platform independent ways of doing this. For example, on Windows you create a resource file with a string table and access it via the Win32 API. I believe there is also a way by using compiler specific pragmas to put strings in a shared data segment so that they are easily accessible by other programs. But the most platform independent way is to open the executable as a file and walk through it looking for a marker string. In the executable you would do something like:
char my_string[] = "japh://Just Another Perl Hacker.\0";
then access it like:
char *string = my_string + strlen("japh://");
to get past the marker. When you read this from another executable, search for the marker string 'japh://'. The string you want starts after the marker and continues until a null terminator is found.
BTW, I'd recomment against using F<META.yml> for application specific configuration. There is already too much fragmentation in the way different tools are generating metadata (see <http://www.thepierianspring.org/meta.stats>). It's sole purpose is to provide information about a distribution to tools that deal with distributions. I believe there is going to be a module soon that will provide a standard way to read and write metadata and that looks at and validates the metadata, and I think Thomas Klausner is going to use this in CPANTS so it may affect the kwalitee of your module.
Oops, dang soapbox slipped up under me. =)
Regards, Randy.
