Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-use TOML::Tiny::Faithful;
+
+BEGIN {
+ $self = $0; $self =~ s{^.*/(?=.)}{};
+ my $deref = $0;
+ while ($deref =~ m{^/}) {
+ my $link = readlink $deref;
+ if (!defined $link) {
+ $! == EINVAL
+ or die "$self: checking our script location $deref: $!\n";
+ $deref =~ s{/[^/]+$}{}
+ or die "$self: unexpected script path: $deref\n";
+ unshift @INC, $deref."/TOML-Tiny/lib";
+ last;
+ }
+ last if $link !~ m{^/};
+ $deref = $link;
+ }
+}
+
use Fcntl qw(LOCK_EX);
use File::Compare;
use Fcntl qw(LOCK_EX);
use File::Compare;
-
-my $self = $0; $self =~ s{^.*/(?=.)}{};
+use TOML::Tiny::Faithful;
our $worksphere = getcwd() // die "$self: getcwd failed: $!\n";
$worksphere =~ s{/[^/]+$}{} or die "$self: cwd \`$worksphere' unsupported!\n";
our $worksphere = getcwd() // die "$self: getcwd failed: $!\n";
$worksphere =~ s{/[^/]+$}{} or die "$self: cwd \`$worksphere' unsupported!\n";