Search code examples
perl

Perl5 compile-time err "I don't know where I am! (Do you?)"


I haven't found this compile-time error in Perl documentation or Web searches; does it ring a bell for anybody? Perl 5.32 on Windows. The full error:

I don't know where I am! (Do you?) DESKTOP-FUM 
Compilation failed in require at distrib.bat line 23. 
BEGIN failed--compilation aborted at distrib.bat line 23.

The code in distrib.bat begins:

use 5.010; use strict 'subs'; use integer; use warnings; use English;
use File::Copy; use Getopt::Std; use Time::Piece; use feature 'switch';
BEGIN { # determine where to find my library
unshift @INC, ($^0 eq "darwin") ? "/Users/roddy/foopath" : "$ENV{USERPROFILE}/fumpath";
} # BEGIN
use rwelib;  # <- line 23

rwelib has no BEGIN block; it starts with the only "require" in the code:

require 5; use English;
use Sys::Hostname;
(etc)

distrib.bat uses a typical wrapper for Perl scripts. Line number was adjusted accordingly.

I've run this script many times; this error happens on a new Perl installation in India, so it's slow for me to debug!

Any ideas?


Solution

  • 😳 Thanks, all, for your thoughtful responses, which I've noted for the future.
    I had neglected the basic principle that error messages should be clear and indicate where they originate. And forgotten that below the many functions defined in the library file, initialization code had been written a few years ago. It didn't recognize the new host, and was being cute. (sigh) I should know better; off my game for some reason. 😳