# Notice: this will work with Apache, cheap web-server might be a serious issue! # a) Detect if we are called by the web-server or not # b) Set the path accordingty BEGIN { # Adding application lib path my $libdir = undef; if ( not defined($ENV{SERVER_NAME}) ) { $libdir = getcwd; } else { $libdir = File::Basename::dirname($ENV{SCRIPT_FILENAME}); } # I know.... but sometimes I am lazy! chdir "$libdir/../lib"; $libdir = getcwd; if ( not grep(/$libdir/, @INC) ) { push (@INC, $libdir); } undef $libdir; }