Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
more useful options
 
PerlMonks  

Re: Dual constant files

by Adam (Vicar)
on Mar 13, 2001 at 01:54 UTC ( [id://64050]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Dual constant files

I agree that you only want one constants file. Since Java is compiled, you can add a compiler step to generate the java constants file off of your Perl one. You could even write the code to do that in Perl.

Alternatively, you can write your constants in Java and write a constants module in Perl which uses AUTOLOAD to cull them from the java file as needed. This is a particularly cool way to do it (in my opinion) and it is a great use for AUTOLOAD. I actually did something similar for a company, where I had a hash table of constants and an AUTOLOADer to convert them to subroutines as needed. But watch out for non-scalar constants... arrays and hashes don't play as nice with eval.

Search for more on AUTOLOAD

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://64050]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.