NAME

App::Project::Doctor::Check::Dependencies - Check that used modules are declared

DESCRIPTION

Scans all .pm, .pl, and script files for use/require statements and compares against cpanfile or Makefile.PL prerequisites (via App::makefilepl2cpanfile). Core modules are excluded.

MESSAGES

Code | Trigger                      | Resolution
-----|------------------------------|-------------------------------------------
D001 | No builder or cpanfile found | Add a Makefile.PL or cpanfile
D002 | Module used but not declared | Fix appends a 'requires' line to cpanfile

FORMAL SPECIFICATION

used     = { mod | (use|require mod) in source_files ctx }
declared = parse_prereqs (builder_file ctx)
missing  = used \\ (declared union CORE)

check ctx ==
  if declared = undef then [warning]
  else [error+fix per m in missing] ++ (if missing = {} then [pass] else [])

AUTHOR

Nigel Horne <njh@nigelhorne.com>

LICENSE

Copyright (C) 2026 Nigel Horne. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.