dhsnapshot icon indicating copy to clipboard operation
dhsnapshot copied to clipboard

Can't locate dhsnapshot.conf in @INC if not running from dir

Open mbernasocchi opened this issue 10 years ago • 0 comments

When running from outside the dir whre dhsnapshot.conf is i get:

Can't locate dhsnapshot.conf in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at ./dhsnapshot/dhsnapshot.pl line 9.

applying this patch makes it work:

diff --git a/dhsnapshot.pl b/dhsnapshot.pl
index 1d3ebc3..53a36af 100755
--- a/dhsnapshot.pl
+++ b/dhsnapshot.pl
@@ -6,7 +6,11 @@ our %conf;
 $conf{'basedir'} = get_basedir();
 $conf{'emptydir'} = "$conf{'basedir'}/__emptydir/";

-require 'dhsnapshot.conf';
+use File::Basename;
+use Cwd 'abs_path';
+my $bd = dirname(abs_path($0));
+my $conf_file = "$bd/dhsnapshot.conf";
+require $conf_file;

 my $lowest_interval = 'daily';
 my %rotation;

mbernasocchi avatar Apr 10 '14 15:04 mbernasocchi