check in the paths in each cells @INC array for the file u want in the array cell assending order fist maching file is the loaded one
like this if any body have a better way to check existents of a file please send $file_to_search='sos.pl'; #******************** Your file to find for($c=$#INC; $c>-1; $c--){ #******** Search In all the paths in the list reverse order is very important bocouse it is the priority assending oder $err=10; open(T,"<$INC[$c]/$file_to_search")or $err=1; # $err will be 1 if file is not there if ($err==10){ #********** if file egxist close(T); #********** close it $filepath= "$INC[$c]/$file_to_search"; #*************** Add the file $find_file=1; #********** set as file is found } } if ($find_file){ # if find print print "$filepath"; }else{print "cant locate file $file_to_search"; } ----- Original Message ----- From: "Jenda Krynicky" <[EMAIL PROTECTED]> To: "Reinstein, Shlomo" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, October 17, 2002 12:06 AM Subject: RE: How to use a module located relative to the current script > From: "Reinstein, Shlomo" <[EMAIL PROTECTED]> > > Thanks. However, I think this module won't help me. You see, > > "some_path/lib/sos.pl" is not the "original" (bin) script, but rather > > it's a library of routines used by many "original" scripts. That is to > > say, users don't run "perl some_path/lib/sos.pl", but rather they run > > some other script which knows how to locate and require sos.pl. Shlomo > > I see. > Could you try to print > $INC{'sos.pl'} > or (if that doesn't print anything) use > foreach (keys %INC) { > print "\t$_ => $INC{$_}\n"; > } > > This should tell you where was the sos.pl loaded from. > You may then strip the 'sos.pl' from the path with a regexp and > append '../modules'. > > Jenda > =========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz > ========== > When it comes to wine, women and song, wizards are allowed > to get drunk and croon as much as they like. > -- Terry Pratchett in Sourcery > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]