
davorg
Thaumaturge
/ Moderator
Jan 13, 2005, 9:00 AM
Post #6 of 13
(601 views)
|
|
Re: [DrewJones] Instantiating a class when name is in variable?
[In reply to]
|
Can't Post
|
|
index.cgi #!/usr/bin/perl -w package app; use strict; use warnings; use modules::conf; $themedir = './themes/' . $app::conf->{theme}; # has value if printed use lib ( './modules', $themedir, # does not work './' ); As I hinted at in my last email, the problem is that the "use lib" line is executed at compile time, but $themedir isn't given a value until runtime (which is later). Try putting the code which sets $themedir into a BEGIN block. I mean, replace the line:
$themedir = './themes/' . $app::conf->{theme}; with
BEGIN { $themedir = './themes/' . $app::conf->{theme}; } -- Dave Cross, Perl Hacker, Trainer and Writer http://www.dave.org.uk/ Get more help at Perl Monks
|