#!/usr/bin/env perl
########################################################################
# Check for etc/app.conf symlinks whose target is missing: nostrict
# returns them along with the live files.  See POD.
########################################################################

use v5.40;

# nostrict: every etc/app.conf above the program, live or dangling.

use FindBin::Files  qw( file=etc/app.conf nostrict nofail );

my @dead    = grep { ! -e } @app_conf;

@dead
and die "Dangling config links:\n"
. join '' => map { "    $_ -> " . readlink . "\n" } @dead;

say "Config: $_"
for @app_conf;

__END__

=head1 NAME

dangling_conf - report etc/app.conf symlinks that point to nothing

=head1 SYNOPSIS

    dangling_conf

=head1 DESCRIPTION

    use FindBin::Files qw( file=etc/app.conf nostrict nofail );

    my @dead = grep { ! -e } @app_conf;

By default FindBin::Files skips a symlink whose target is missing:
the program then quietly uses a farther config, or none.  When
configs are symlinks into a shared tree (a deployment directory, a
mounted volume, another checkout) a broken link usually means
something was moved or not mounted, and is better reported than
skipped.

C<nostrict> returns dangling links along with the files; C<-e> is
false for the dangling ones.  The program dies listing each one and
its target, or prints the configs found:

    Dangling config links:
        /work/projects/etc/app.conf -> /mnt/config/app.conf

=head1 SEE ALSO

L<FindBin::Files>, F<example/find_app_conf>
