in reply to Bulk check for successful compilation
I guess one caveat I might make about the Test::Compile::Internal module is that it tests for successful compilation by using the perl executable (and its associated set of module libraries) that was specified in the shebang line of the script that called it. I'll call it the "tester script" for purposes of the rest of this post.
If I have multiple Perl installations, the script being tested (i.e., any of the Perl scripts that the Test::Compile::Module locates in various directories) might have a shebang line that specifies the perl executable (which of course has an associated set of module libraries) that is different from the one on the shebang line of the tester script.
My goal is to see whether the tested script compiles correctly under the perl executable that's going to be compiling and running it -- the one specified on its shebang line. The tested script might be called in the middle of the night by a cron job, or Apache calls it via CGI, or a user enters its path and name at a Linux command line. Here's where a problem arises: If my tester script uses different perl executable/libraries than the tested script, and a particular module has been installed in the Perl libraries used by the tester script but not in the Perl libraries used by the tested script (because I forgot to install it, for example, which might happen if I've upgraded the Perl installation I'm wanting the tested script to run on), the tester script would cheerfully report that the tested script successfully compiles. But in fact it will fail when it's called in practice. A similar problem would arise if a particular module used by a tested script already is correctly installed but it has NOT been installed in the libraries of the tester script (e.g., a CPAN module that's not part of the core modules in the Perl installation under which the tester script is running and has never been installed manually). In that case, the tester script will report that the tested script failed to compile, when in fact it will fail when it's called in practice.
Would it make sense for the Test::Compile::Internal's code to be modified so that it scrapes the shebang line of the tested file in order to determine and then run the Perl executable (and its corresponding set of Perl libraries) to do the compilation test? Perhaps in most cases there will be no difference between that shebang line and the tester script's shebang line, but sometimes not.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Bulk check for successful compilation
by davebaker (Pilgrim) on Jul 08, 2022 at 00:13 UTC |