Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C style header files in perl 1

Status
Not open for further replies.

Vovin

Programmer
Aug 24, 2003
63
GB
Hi,

I have a list of constants that I want to re-use in several *.pl and *.pm files e.g.

# boolean values
use constant TRUE => 1;
use constant FALSE => 0;

I want to put this stuff in an external file and not copy/paste it into every file that uses it. Sort of like a C++ header file.

Can anyone tell me what the best way of doing this would be? I've tried doing

do '/data/home/vovin/config/foo.cfg' or warn "failed to parse $!";

but it didn't work correctly. Any help would be much appreciated. Thanks.
 
Code:
require "constants.pl";

Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Thanks Paul. I knew it would have to be something simplelike that. I'll give CPAN a look.
 
:) That's his sig Vovin,. it's not aimed at you in particular.

Mike

I am not inscrutable. [orientalbow]

Want great answers to your Tek-Tips questions? Have a look at faq219-2884

 
Sorry about that Vovin, was running out the door, should have signed off properly ;-)

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top