NAME
Developer::Dashboard::CLI::OpenFileUtil - small shared helpers for dashboard of
SYNOPSIS
use Developer::Dashboard::CLI::OpenFileUtil qw(_unique_matches _unique_existing_dirs);
DESCRIPTION
Holds the two tiny deduplication helpers shared between Developer::Dashboard::CLI::OpenFile and Developer::Dashboard::CLI::OpenFileJavaSource (DD-918's split). Neither module imports from the other, so both depend on this instead - avoiding a circular use between the two larger modules.
PURPOSE
Deduplicate a list of file or directory path strings while preserving original discovery order, optionally requiring each surviving candidate to be an existing directory.
WHY IT EXISTS
Developer::Dashboard::CLI::OpenFile and Developer::Dashboard::CLI::OpenFileJavaSource both need these two one-line-bodied helpers. Having either module import from the other would create a circular dependency at compile time, since each also needs to call into the other (OpenFile dispatches into OpenFileJavaSource for Java lookups). A tiny shared module both depend on breaks the cycle.
WHEN TO USE
Use this file when either OpenFile.pm or OpenFileJavaSource.pm needs a third consumer for these helpers, or when their dedup semantics need to change in one place for both.
HOW TO USE
use Developer::Dashboard::CLI::OpenFileUtil qw(_unique_matches _unique_existing_dirs);
my @deduped = _unique_matches(@candidates);
my @dirs = _unique_existing_dirs(@candidates);
WHAT USES IT
Developer::Dashboard::CLI::OpenFile and Developer::Dashboard::CLI::OpenFileJavaSource.
EXAMPLES
_unique_matches(qw(a b a c)); # => (a, b, c)
_unique_existing_dirs('/tmp', '/nonexistent-xyz'); # => ('/tmp')