Ah, gotcha.
I use something like this for situations where I have a local "lib" directory. You could probably modify it somewhat:
#!/usr/bin/perl
use strict; # Always use strict.
my $BASEPATH;
#
# Include path magic.
#
BEGIN {
use File::Basename;
use File::Spec;
my $PROGRAM = File::Spec->rel2abs( $0 );
( undef, $BASEPATH, undef ) = fileparse( $PROGRAM );
$BASEPATH = File::Spec->catdir( $BASEPATH, "../" );
my $LIBPATH = File::Spec->catdir( $BASEPATH, "lib" );
eval " use lib '$LIBPATH'";
}
If you want to keep the module files in the same directory this BEGIN block should work (I haven't tested it):
BEGIN {
use File::Basename;
use File::Spec;
my $PROGRAM = File::Spec->rel2abs( $0 );
( undef, $BASEPATH, undef ) = fileparse( $PROGRAM );
eval " use lib '$BASEPATH'";
}
|