my first version was regex-based. i can already see your horrified face - but really it wasn't so bad, since it only needed to find some specific statements such as uses and requires. current version is using ppi, which is better suited for corner cases.
however, long-term makes me think that it would be better to rely on an external module. so, what are the alternatives out there on cpan, and can i use them in autoprereq?
- b::perlreq - parses the file, but reports file (File/Basename.pm) instead of modules, and is generally more suited for rpm
- module::extract::use - using ppi to parse a file, but extracts only use & require statements (no inheritance, moose roles, etc). also, it reports no minimum version extraction, only a list of modules.
- test::dependencies - using either b::perlreq (see above) or a regex scheme underneath
- module::scandeps - runs the file (which is slow), and finds all modules included - and sometimes a bit more (eg: file::homeDir::darwin is found for a module using file::homedir, even on a unix platform). can also run as a static analyser, but calls cpanplus (?!) which is slow.
- module::info - regex based
- module::cpants::generator::prereq - parses makefile.pl, where i want sthg that parses actual code
- module::cpants::kwalitee::prereq - parse meta.yml, makefile.pl or build.pl
i'm now waiting for a new release of this module with my enhancements, meaning that i can get rid of this part of the code in dzil autoprereq. which was, if you recall, the original goal! :-)