On Wed, 31 May 2000, Perrin Harkins wrote:
Thanks for the reply. I have a few problems though:
> You need to read up a little on modules and "require" in Perl5.
>
> The quick and dirty solution is to use "do" instead of require. That will
> solve your immediate problem, but you'll still be reading the files every
> time which might eventually become a performance hit.
I can't seem to get "do" to work. I did this:
my $series_name;
do "series_$series.i"; # <-- note include filename depends on a variable
print "$series_name\n";
but $series_name comes out undefined, even though series_$series.i (in
this case, series_ranma.i) sets $series_name.
I also tried the package thing:
> What I do when I have things like config files is make actual unique
> packages of them. For example:
>
> (In My/Module.pm)
> package My::Module;
> # don't use strict here
> $foo = 7;
>
> (In some other program)
> use My::Module;
> print "$My::Module::foo\n";
How would this work if the include filename has to depend on a variable? I
think I have the parsing wrong; I kept getting error messages. e.g.
something like:
use $series;
print "$$series::series_name\n";
> Honestly though, your example makes it look like you'd be better off with
> dbm files and Tie::MLDBM or something.
The database files would have to be human readable though, such that they
can be edited by a text editor. The data that I am making includes an
index to content that is maintained by other webmasters. The other
webmasters don't even know how to use a UNIX shell, so I have to keep it
simple for them. If I used a binary file format I'd have to make them
learn the tools for changing it.
-Philip Mak ([EMAIL PROTECTED])