Cole Tuininga writes: > I have a module (call it MyMod.pm) that I want to use in a program, but > I can't install it in with the rest of the perl libraries. For reasons > that are too boring to get into, the only guarantee I have is that it > will be in the same directory as the executable script. > > How can I set up my include path (within the perl script) to make sure > that the directory of the executable is in the include path? I can't > hard code it because the location might be different on different > machines (different mount points).
Try this: #!/usr/bin/perl BEGIN { $dirname = $0; $dirname =~ s#(.*/).*#$1#; eval "use lib qw($dirname)"; } use MyMod; Hope this helps, --kevin -- GnuPG ID: B280F24E _______________________________________________ gnhlug-discuss mailing list gnhlug-discuss@mail.gnhlug.org http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss