http://www.perlmonks.org?node_id=11124519

skendric has asked for the wisdom of the Perl Monks concerning the following question:

I tried upgrading from 5.30.0 to 5.32.0 and hit the following with some of my scripts

Can't locate DateTime/TimeZone/Local/Unix.pm: /opt/local/lib/perl5/site_perl/5.32.0/DateTime/TimeZone/Local/ +Unix.pm: T oo many open files at /opt/local/lib/perl5/site_perl/5.32.0/Module/Run +time.pm li ne 314 (#1) (F) You said to do (or require, or use) a file that couldn't be fo +und. Perl looks for the file in all the locations mentioned in @INC, un +less the file name included the full path to the file. Perhaps you nee +d to set the PERL5LIB or PERL5OPT environment variable to say where +the extra library is, or maybe the script needs to add the library nam +e to @INC. Or maybe you just misspelled the name of the file. See "require" in perlfunc and lib.

The file '/opt/local/lib/perl5/site_perl/5.32.0/DateTime/TimeZone/Local/Unix.pm' exists ... so I suppose that Perl isn't opening it because it has run out of ... available file handles? What is the name of the resource which has been exhausted and whose exhaustion leads to the 'too many open files' message?

Looking at Runtime.pm .... Line #314 is the 'return scalar ...' line

sub require_module($) { # Localise %^H to work around [perl #68590], where the bug exi +sts # and this is a satisfactory workaround. The bug consists of # %^H state leaking into each required module, polluting the # module's lexical state. local %^H if _WORK_AROUND_HINT_LEAKAGE; if(_WORK_AROUND_BROKEN_MODULE_STATE) { my $notional_filename = &module_notional_filename; my $guard = bless([ $notional_filename ], "Module::Runtime::__GUARD__"); my $result = CORE::require($notional_filename); pop @$guard; return $result; } else { return scalar(CORE::require(&module_notional_filename) +); } }

What is 'sub module_notional_filename'? Well, Runtime.pm contains the following:

[...] The notional filename for the named module is generated and returned. This filename is always in Unix style, with C</> directory separators and a C<.pm> suffix. This kind of filename can be used as an argument + to C<require>, and is the key that appears in C<%INC> to identify a modul +e, regardless of actual local filename syntax. =cut sub module_notional_filename($) { &check_module_name; my($name) = @_; $name =~ s!::!/!g; return $name.".pm"; } [...]

Hmm, I'm running into my own lack of expertise here ... I don't see how 'sub require_module' and 'sub module_notional_filename' relate to counting how many open files I have

Anyone have pointers on what I am seeing?

I rolled back to perl 5.30.0, which restores the original behavior (i.e. none of these 'Too many open files' messages

I am running on Ubuntu, 5.4.0-54-generic

--sk