Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mbernasocchi opened this issue Apr 10, 2014 · 0 comments · May be fixed by #4
Open

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

mbernasocchi opened this issue Apr 10, 2014 · 0 comments · May be fixed by #4

Comments

@mbernasocchi
Copy link

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 added a commit to mbernasocchi/dhsnapshot that referenced this issue Apr 10, 2014
@mbernasocchi mbernasocchi linked a pull request Apr 10, 2014 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant