Jump to content
SSForum.net is back!

Perl - How to "include" like in PHP?


Recommended Posts

Posted (edited)

my %config = 
(
require "./config.pl";	# load user accessible configuration

blahblahotherstuffhere;
);

 

That obviously does not work. How do I get it to load a specific file -- or "include" just like in PHP?

 

EDIT: That or someone ought to package me a TCAdmin/formal-gameserver ready package of ChatNet. :( Then I could offer ChatNet hosting. blum.gif

Edited by L.C.

BlueT Network Administrator

SSCV Network Administrator

Jackpot SVS System Operator

http://www.hlrse.net/Qwerty/randomsubsbar.jpg

http://www.hlrse.net/Qwerty/BlueToastWebhosting.gif

Posted

I usually do something along the lines of:

 

my %defaultconfig = (
 bla => 'bla',
);
my %userconfig = do "bnc.conf" or die("Unable to load config file: $!");
my %config = (%defaultconfig, %userconfig);

 

bnc.conf looks like:

return (
 something => 'bla'
);

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...