[Israel.pm] Fwd: Phantom "require 'utf8.pm' "

Gabor Szabo szabgab at gmail.com
Thu Feb 23 06:08:24 PST 2006

for some reason Jason could not post this so here it is
---------- Forwarded message ----------
From: "Jason Elbaum" <jason.elbaum at gmail.com >
To: "Perl in Israel" <perl at perl.org.il>
Date: Thu, 23 Feb 2006 15:52:17 +0200
Subject: Phantom "require 'utf8.pm' "

I'm running a perl script consisting of many packages (classes) in a
single text file. It "use"s no modules, not even any system modules.
The words "use" and "require" do not appear anywhere in the code.

 Until now, everything has run fine. Suddenly, on one execution
platform, I'm getting the following error message:

 Can't locate utf8.pl in @INC (@INC contains: .... ) at ....prl line
2680, <IN> line 1.BEGIN failed--compilation aborted, <IN> line 1.}

 (I've omitted the @INC path and the name of the script file)

 The version of perl is 5.8.0 on Solaris. (On Linux, this message does
not appear.)

 I know why it can't find the module - the system modules are not
installed correctly. That doesn't bother me, since I don't need any of
them. What I don't understand is why the heck my code is *trying* to
access utf8.pl!

 The relevant code snippet is as follows:

 sub readLine {
  my $self = shift;
  my $file = shift;
  while (defined (my $line = <$file>)) {
  print "Reading LINE: '$line'\n" if $self->{DEBUG};
  if ($line =~ /\S/) {    # **** THIS IS LINE 2680!! **** #
  chomp $line;
  print "Returning LINE: '$line'\n" if $self->{DEBUG};
  return $line;

 Revving up the old Perl debugger (which I hardly ever do!), I get the
following stack trace (filename omitted):

 $ = require 'utf8.pm' called from file `...' line 2680
 $ = FileReader::BEGIN() called from file
`sub-projects/perl/perl_staticS/lib/5.8.0/utf8.pm' line 0
 $ = eval {...} called from file
`sub-projects/perl/perl_staticS/lib/5.8.0/utf8.pm' line 0
 $ = FileReader::readLine(ref(FileReader), ref(GLOB)) called from file
`...' line 2451

 I'm stumped! Where in readLine() is there an eval {} ? Why should
BEGIN suddenly be called? What's triggering the "require 'utf8.pm'"?

 Suggestions would be welcome.


 Jason Elbaum
 Freescale Semiconductor Israel

More information about the Perl mailing list