Script-isAperlScript reviews

cpanratings
 

RSS | Module Info | Add a review of Script-isAperlScript

Script-isAperlScript (0.0.0) *

This module offers a microscopic subset of the functionality of file(1)/magic(5) (CPAN already has more than enough modules dealing with that topic, e.g. File-LibMagic). As of its initial release, it does not deal with hashbangs delegating an interpreter through env(1), nor would it recognise scripts installed by a custom Perl installation or by CPAN that clearly refer to the perl interpreter that is also sitting in the path.

The interface is exported function, yet returns exit codes like a shell program and CORE::system. I thought everyone knew by 2010 that this is a design mistake not to be repeated, meaning 0 stands for okay and 1 stands for not okay. The author is evidently aware of that because he takes care to explicitely comment this confusing behaviour in the synopsis.

Given this interface, the module's functionality would have benefitted from being expressed as a command line script alone. However, since it is in module/function form, returning error codes instead of exceptions IMO is doing it the wrong way, not very perlish.

The code does not follow the usual identifier naming conventions, but is straightforward without unnecessary embellishments and therefore easy to comprehend. Yet one cannot help but wonder how an accomplished CPAN author does not know how to avoid code repetition by iterating over a list, or to use alternative delimiters for the m operator in order to make RE more readable.

One star to dissuade people from using: I cannot see anything good coming of this; any further effort should be spent improving the magic(5) database.