
photores
Deleted
Jan 18, 2001, 3:04 PM
Post #1 of 3
(407 views)
|
|
"require" function don't work.
|
Can't Post
|
|
Hi! I writing now small perl data base module, and try use for table configuration saving, make perl file with table config hash and then load it with "require" function. I write small script for testing, and it work! But if I put code in module, ...:-(. Have not any messages about errors in $!, but I can't see any variables in config file. Please, help :-) Code samples is below: # module code fragment: package DB_lib; sub insert_into { my $self = shift; my $t_name = shift; my $in = shift; my %IN = %{$in}; my $db_name = $self->{'db_name'}; my $db_dir = $self->{'db_dir'}; my(@in,$f,); chdir "$db_dir"; require "$t_name.cfg"; # I seem, after this print "$r_length"; # I can use all variables in this file?? } 1; ############################################## # config file $t_name.cfg: if($t_name =~ "image_sizes") { $T_CFG{'ID'} = {type=>"ID",size=>"4",start_p=>0}; $T_CFG{'size'} = {type => "char",size => 30,start_p => 4}; $r_length = 36; $last_id = 0; }else { return 2;}
|