Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.92k stars 551 forks source link

AutoLoad/AutoSplit negates compile- and run- time strict/warnings #4510

Open p5pRT opened 22 years ago

p5pRT commented 22 years ago

Migrated from rt.perl.org#7825 (status was 'open')

Searchable as RT7825$

p5pRT commented 22 years ago

From jwest@cptech.com

Consider the following module.

---[begin​: testmod.pm]--- package testmod;

use strict; use warnings; use AutoLoader qw(AUTOLOAD);

1;

__END__

sub test_routine {

  my $foo = "foo";   print "$typo\n";

} ---[end​: testmod.pm]---

If one is to\, after creating this file\, run perl -c against it\, it compiles correctly\, as opposed to getting the message​:

Global symbol "$typo" requires explicit package name at testmod.pm line 14.

as one might expect when using strict. Without strict\, you also do not get the usual warning​:

Name "testmod​::typo" used only once​: possible typo at testmod.pm line 14.

I can understand that this is likely the case as code after the __END__ token is highly irregular\, except in terms of AutoSplit. The work around\, of course\, is to comment out the __END__ token so that strict and warnings will also consider the additional code\, and uncomment the __END__ token after debugging to re-enable AutoSplit'ing.

What's more\, if you were to AutoSplit the module a la MakeMaker and use it\, the strictures and warnings continue to not function. The module is use'd\, and test_routine would be AutoLoad'd without any notice of an error\, though strict and warnings are in place.

It seems to me that either AutoSplit should be changed to not expect code to be placed after the __END__ token\, or that the strict and warnings pragmas be applied to code after the __END__ token\, and subsequently upon being AutoLoad'd.

If these are known problems\, or non-issues\, I apologize for taking up your time with this bug report.

Thank you for your consideration. If I can be of further service\, please do not hesitate to contact me.

--John West

-- John West- Systems Consultant\, Perl Monk jwest@​cptech.com Corporate Technologies\, Inc. 781-273-4100\, x118

Perl Info ``` Flags: category=core severity=medium Site configuration information for perl v5.6.1: Configured by bod at Fri Jun 22 18:58:01 EST 2001. Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration: Platform: osname=linux, osvers=2.4.5-ac9, archname=i386-linux uname='linux duende 2.4.5-ac9 #1 thu jun 21 00:52:39 est 2001 i686 unknown ' config_args='-Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i386-linux -Dprefix=/usr -Dprivlib=/usr/share/perl/5.6.1 -Darchlib=/usr/lib/perl/5.6.1 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.6.1 -Dsitearch=/usr/local/lib/perl/5.6.1 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Uusesfio -Dotherlibdirs=/usr/lib/perl5/5.6:/usr/lib/perl5/5.005 -Duseshrplib -Dlibperl=libperl.so.5.6.1 -Dd_dosuid -des' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef Compiler: cc='cc', ccflags ='-DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-DDEBIAN -fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='2.95.4 20010604 (Debian prerelease)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lgdbm -ldbm -ldb -ldl -lm -lc -lcrypt perllibs=-ldl -lm -lc -lcrypt libc=/lib/libc-2.2.3.so, so=so, useshrplib=true, libperl=libperl.so.5.6.1 Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib' Locally applied patches: @INC for perl v5.6.1: /usr/local/lib/perl/5.6.1 /usr/local/share/perl/5.6.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.6.1 /usr/share/perl/5.6.1 /usr/local/lib/site_perl /usr/local/lib/perl/5.6.0 /usr/local/share/perl/5.6.0 /usr/lib/perl5/5.6/i386-linux /usr/lib/perl5/5.6 /usr/lib/perl5/5.005/i386-linux /usr/lib/perl5/5.005 . Environment for perl v5.6.1: HOME=/home/jwest LANG=C LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games PERL_BADLANG (unset) SHELL=/bin/bash ```
p5pRT commented 14 years ago

From marc.girod@gmail.com

This problem is unchanged in 5.10.

Would it be possible to disable the use of the split hierarchy on a special flag\, say -/nosplit? This would be useful e.g. in conjunction with 'perl -c' and would fall back to using the plain module file(s).

I am assuming that this could restore the "use (strict|warnings)" functionality...