Ñåðãåé ×åðíèåíêî wrote: > Well, really the only point of confusion is relativ position of some > script named, say, caller.pl which require some other script, > traditionally named 28esp.pl :-). In my answers I supposed that > caller.pl placed in some_arbitrary_folder and in the same folder > there is directory includes with file 28esp.pl.
Three conditions need to be known and haven't been supplied. Full path of current working directory. Full path of script1. Full path of required script2. > In such case, as far as I understand, in caller.pl should work following: > require "includes/28esp.pl"; #or > require "includes\\28esp.pl"; #or > require 'includes\28esp.pl'; #or > require 'includes/28esp.pl'; #or > > require ".\\includes\\28esp.pl"; #or > require "./includes/28esp.pl"; #or > require '.\includes\28esp.pl'; #or > require '.\includes\28esp.pl'; #or That's all fine if the CWD contains a dir 'includes' which holds script2. > require "\\includes\\28esp.pl"; #only if some_arbitrary_folder > #is root folder > require "/includes/28esp.pl"; #only if some_arbitrary_folder > #is root folder > require '\includes\28esp.pl'; #only if some_arbitrary_folder > #is root folder > require '/includes/28esp.pl'; #only if some_arbitrary_folder > #is root folder The point here is he said this worked on UNIX. That would be impossible unless the script was in / which we can be pretty sure it wasn't cause / normally would contain only mounted FSs (eg: usr/etc/home/var). > Then about path separators: slash is obviously more universal - it > works on both *NIX and Windows. Slash make script portable. Correct. > In case when caller.pl and 28esp.pl palced in different arbitrary > folders then it's better (my opinion) use lib pragma > > lib 'x:/absolute/path/of/includes/folder'; An arbitrary choice IMO. > After that works all of first eight variants listed earlier except > one: > require "./28esp.pl"; You mean the first 8 variants without the 'includes/' part. > I can't guess why it produces an error. That's easy. You're supplying a path relative to '.' so it won't try to find script2 in lib dir. You have to leave './' off or use a path relative to lib dir: lib 'C:/mystuff'; # which has an includes dir in it require 'includes/28esp.pl'; # should work lib 'C:/mystuff/includes'; require '28esp.pl'; # should also work -- ,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED] (_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED] / ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/ -/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff) _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs