You don't tell us what errors you get. Also, you have no error checking when you eval your script. Even more, the code is horribly ugly and unformatted and not at all self-contained so it's quite hard to guess what it does. I'm rewriting it with more legible syntax and some added error checking - that might help you to diagnose the exact error you get:
subfile('iocommon');
sub subfile {
my($f)=@_;
my($w);
# %GOT_HA seems to be a variable emulating %INC maybe?
if(!$GOT_HA{$f}){
# where do $my_base_loc, $subslocation and $ds come from?
# is that a case for using File::Spec instead?
$f=("$my_base_loc$subslocation$ds$f.sub");
# you need error handling here in case the file is not found:
# Are $t and $rep global variables? What are they used for?
$t=open (IE,"$f") or die "Couldn't open '$f': $!";
$rep=($t)?'OK':$!;
# What does that do? Maybe you want to look in that log for th
+e error report?
db("subfile $f",$rep);
# Are you using strict; at all? You really should!
# This whole section is likely better written as
# my $w = do { local $/; <IE> };
@tt=<IE>;
close(IE);
while(@tt){
$l=trim(shift @tt);
$w.=$l."\n";
}
eval($w);
if (my $err = $@) {
die "Error in evaluating '$f': $!";
};
$GOT_HA{$f}=1;
}
}
Update: The below recommendations of using do or Module::Pluggable sound very good to me and especially do or require should have occurred to me had I looked at the bigger picture... |