~/MyApp |_ /1.0 |_ /1.1 |_ /1.2 |_ /bin |_ script1.pl |_ /util |_ script2.pl |_ /lib |_ /perl |_ Module1.pm |_ Module2.pm |_ /plugins |_ /default |_ plugin1.pl |_ /custom |_ plugin2.pl |_ plugin3.pl |_ /Dir1 |_ Dir2 |_ plugin4.pl #### use strict; use warnings; use File::Spec; use Cwd 2.17 qw(realpath); eval { use lib (eval { my @dirs = File::Spec->splitdir( (File::Spec->splitpath(realpath($0)))[1] ); while (scalar(@dirs) and $dirs[-1] !~ /\d+\.\d+/) { pop(@dirs); } return File::Spec->join(@dirs, 'lib', 'perl'); } ); use Module1; use Module2; }; if ($@) { die "Failed to load custom modules.\n"; }