in reply to Re: Configuration variables using run-time in put without -w complaints?
in thread Configuration variables using run-time in put without -w complaints?

Sorry, the eval is there as a result of recent thrashing, since I read that it is evaluated at run-time. The problem is that the snippet above is a separate config. file, read in with
require '/etc/addvhost2rc';
I've also tried using do {}, as suggested in the Cookbook, but the error messages persist regardless. It's important that it be a separate config file, as the script is intended to run on sites with varying directory layouts, adduser command syntax, etc.
  • Comment on RE: Re: Configuration variables using run-time in put without -w complaints?
  • Download Code

Replies are listed 'Best First'.
RE: RE: Re: Configuration variables using run-time in put without -w complaints?
by Shendal (Hermit) on Jun 27, 2000 at 00:11 UTC
    Oh, okay. Well, if you are doing a require to get the configuration in there, I'd suggest putting everything in the configuration file into a subroutine, then call it when you've done all the necessary set up.

    For example, your config file may look like this:
    # config file sub initConfig { $foo = "$user - bar"; # ... whatever... }
    Where your program file may look like this:
    # program require 'configuration_file'; print "Username:"; chomp($user = <STDIN>); # now $user exists, although you'd wanna check it for validity &initConfig(); # ... continue processing...
    Does that solve your problem? I've done it this way in the past, and it has worked out well.
    Hope that helps!