* David Landgren <[EMAIL PROTECTED]> [2006-07-19 13:40]:
> The problem is that these associations are private to the XS
> and Perl module. The client code does not need to know about
> them, and in fact shouldn't. So I don't want client code to
> know the file exists, and people won't go around trying to
> include it. So the Perl file has to go. 

Might Pod::Constants help?

    =begin constants

        FOO  => 1
        BAR  => 2
        QUUX => 3

    =end constants

And then in the code:

    use Pod::Constants -trim => 1, constants => \my %const;
    use constants \%const;

Then you generate the C header out of the Perl module in the same
way:

    use Pod::Constants;
    import_from_file "lib/Foo/Bar.pm", -trim => 1, constants => \my %const;
    while( my ( $key, $val ) = each %const ) {
        print "#define $key $val\n";
    }

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

Reply via email to