Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

an extra check for __FILE__ in strict.pm contradicts to documentation #15171

Open
p5pRT opened this issue Feb 11, 2016 · 9 comments
Open

an extra check for __FILE__ in strict.pm contradicts to documentation #15171

p5pRT opened this issue Feb 11, 2016 · 9 comments

Comments

@p5pRT
Copy link

p5pRT commented Feb 11, 2016

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

Searchable as RT127512$

@p5pRT
Copy link
Author

p5pRT commented Feb 11, 2016

From Vadim.Konovalov@emc.com

This is a bug report for perl from vadim.konovalov@​emc.com,
generated with the help of perlbug 1.39 running under perl 5.16.0.

The lib/strict.pm module contains this check​:

unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) {
  # Can't use Carp, since Carp uses us!
  my (undef, $f, $l) = caller;
  die("Incorrect use of pragma '${\__PACKAGE__}' at $f line $l.\n");
}

The above chunk of code assumes that it is called from a file on
filesystem with a some given extension (.pm or .pmc).

However - this check violates documented behaviour.
Namely, "perldoc -f require" have this explanation​:

=quote
The require function will look for the "Foo​::Bar" file in the
@​INC array and will complain about not finding "Foo​::Bar" there.
In this case you can do​:

  eval "require $class";

Now that you understand how "require" looks for files with a
bareword argument, there is a little extra functionality going
on behind the scenes. Before "require" looks for a ".pm"
extension, it will first look for a similar filename with a
".pmc" extension. If this file is found, it will be loaded in
place of any file ending in a ".pm" extension.

You can also insert hooks into the import facility by putting
Perl code directly into the @​INC array. There are three forms of
hooks​: subroutine references, array references, and blessed
objects.
=cut

Therefore I must be able to place a code ref into @​INC array which
then provide contents of the "strict" module

In other words - the filename check in "strict.pm" contradicts to
this excerpt from documentation.

This deviation from documented behaviour breaks my hand-crafted
mechanism of packaging perl modules into some ZIP file and then
unzipping those at execution time.
(similar to PAR but a bit different)

Similar problem exists in warnings.pm


Flags​:
  category=core
  severity=medium


Site configuration information for perl 5.16.0​:

Configured by vkonoval at Mon May 21 13​:33​:55 2012.

Summary of my perl5 (revision 5 version 16 subversion 0) configuration​:
 
  Platform​:
  osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread
  uname=''
  config_args='undef'
  hint=recommended, useposix=true, d_sigaction=undef
  useithreads=define, usemultiplicity=define
  useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
  use64bitint=undef, use64bitall=undef, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T',
  optimize='-MD -Zi -DNDEBUG -O1',
  cppflags='-DWIN32'
  ccversion='12.00.8804', gccversion='', gccosandvers=''
  intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
  d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
  ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='link', ldflags ='-nologo -nodefaultlib -debug -opt​:ref,icf -libpath​:"c​:\apps\perl-5.16.0\lib\CORE" -machine​:x86'
  libpth=D​:\MSVStudio\VC98\lib
  libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
  perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
  libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl516.lib
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
  cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt​:ref,icf -libpath​:"c​:\apps\perl-5.16.0\lib\CORE" -machine​:x86'

Locally applied patches​:
 


@​INC for perl 5.16.0​:
  C​:\Work\PerlScripts\mfdev
  C​:\Personal\perlutl
  C​:\Work\PerlScripts\XML
  C​:\Work\PerlScripts\sgml
  C​:\Work\PerlScripts\utl
  C​:\Work\PerlScripts\frutl
  C​:/apps/perl-5.16.0/site/lib
  C​:/apps/perl-5.16.0/lib
  .


Environment for perl 5.16.0​:
  HOME (unset)
  LANG (unset)
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=C​:\ProgramData\Oracle\Java\javapath;c​:\sh;c​:\bin;C​:\apps\perl-5.16.0\bin;C​:\apps\Tcl-8513\bin;C​:\apps\perl-5.16.0\site\bin;C​:\apps\vim74;c​:\cygwin\bin;C​:\apps\graphviz-2.30.1\bin;C​:\Work\apps\Report;C​:\Work\apps\STCMON;C​:\Program Files (x86)\Java\jre1.8.0_25;C​:\Windows\system32;C​:\Windows;C​:\Windows\System32\Wbem;C​:\Windows\System32\WindowsPowerShell\v1.0\;C​:\Program Files (x86)\Common Files\EMC;C​:\Program Files\Perforce;C​:\Program Files\Perforce\DVCS\
  PERL5LIB=C​:\Work\PerlScripts\mfdev;C​:\Personal\perlutl;C​:\Work\PerlScripts\XML;C​:\Work\PerlScripts\sgml;C​:\Work\PerlScripts\utl;C​:\Work\PerlScripts\frutl
  PERL_BADLANG (unset)
  SHELL (unset)

Complete configuration data for perl 5.16.0​:

Author=''
CONFIG='true'
Date='$Date'
Header=''
Id='$Id'
Locker=''
Log='$Log'
PATCHLEVEL='16'
PERL_API_REVISION='5'
PERL_API_SUBVERSION='0'
PERL_API_VERSION='16'
PERL_CONFIG_SH='true'
PERL_PATCHLEVEL=''
PERL_REVISION='5'
PERL_SUBVERSION='0'
PERL_VERSION='16'
RCSfile='$RCSfile'
Revision='$Revision'
SUBVERSION='0'
Source=''
State=''
_a='.lib'
_exe='.exe'
_o='.obj'
afs='false'
afsroot='/afs'
alignbytes='8'
ansi2knr=''
aphostname=''
api_revision='5'
api_subversion='0'
api_version='16'
api_versionstring='5.16.0'
ar='lib'
archlib='c​:\apps\perl-5.16.0\lib'
archlibexp='D​:\perl-tests\perl-5.16.0\lib'
archname='MSWin32-x86-multi-thread'
archname64=''
archobjs=''
asctime_r_proto='0'
awk='awk'
baserev='5'
bash=''
bin='c​:\apps\perl-5.16.0\bin'
binexp='c​:\apps\perl-5.16.0\bin'
bison=''
byacc='byacc'
byteorder='1234'
c=''
castflags='0'
cat='type'
cc='cl'
cccdlflags=' '
ccdlflags=' '
ccflags='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T'
ccflags_nolargefiles='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T'
ccflags_uselargefiles=''
ccname='cl'
ccsymbols=''
ccversion='12.00.8804'
cf_by='vkonoval'
cf_email='vadim.konovalov@​alcatel-lucent.com'
cf_time='Mon May 21 13​:33​:55 2012'
charbits='8'
chgrp=''
chmod=''
chown=''
clocktype='clock_t'
comm=''
compress=''
contains='grep'
cp='copy'
cpio=''
cpp='cl -nologo -E'
cpp_stuff='42'
cppccsymbols=''
cppflags='-DWIN32'
cpplast=''
cppminus=''
cpprun='cl -nologo -E'
cppstdin='cppstdin'
cppsymbols=''
crypt_r_proto='0'
cryptlib=''
csh=''
ctermid_r_proto='0'
ctime_r_proto='0'
d_Gconvert='sprintf((b),"%.*g",(n),(x))'
d_PRIEUldbl=''
d_PRIFUldbl=''
d_PRIGUldbl=''
d_PRIXU64=''
d_PRId64=''
d_PRIeldbl=''
d_PRIfldbl=''
d_PRIgldbl=''
d_PRIi64=''
d_PRIo64=''
d_PRIu64=''
d_PRIx64=''
d_SCNfldbl=''
d__fwalk=''
d_access='define'
d_accessx=''
d_aintl=''
d_alarm='define'
d_archlib='define'
d_asctime64=''
d_asctime_r=''
d_atolf=''
d_atoll=''
d_attribute_deprecated=''
d_attribute_format=''
d_attribute_malloc=''
d_attribute_nonnull=''
d_attribute_noreturn=''
d_attribute_pure=''
d_attribute_unused=''
d_attribute_warn_unused_result=''
d_bcmp=''
d_bcopy=''
d_bsd='define'
d_bsdgetpgrp=''
d_bsdsetpgrp=''
d_builtin_choose_expr=''
d_builtin_expect=''
d_bzero=''
d_c99_variadic_macros=''
d_casti32=''
d_castneg='define'
d_charvspr=''
d_chown=''
d_chroot=''
d_chsize='define'
d_class=''
d_clearenv=''
d_closedir='define'
d_cmsghdr_s=''
d_const='define'
d_copysignl=''
d_cplusplus=''
d_crypt='define'
d_crypt_r=''
d_csh=''
d_ctermid=''
d_ctermid_r=''
d_ctime64=''
d_ctime_r=''
d_cuserid=''
d_dbl_dig='define'
d_dbminitproto=''
d_difftime='define'
d_difftime64=''
d_dir_dd_fd=''
d_dirfd=''
d_dirnamlen='define'
d_dlerror='define'
d_dlopen='define'
d_dlsymun=''
d_dosuid=''
d_drand48_r=''
d_drand48proto=''
d_dup2='define'
d_eaccess=''
d_endgrent=''
d_endgrent_r=''
d_endhent=''
d_endhostent_r=''
d_endnent=''
d_endnetent_r=''
d_endpent=''
d_endprotoent_r=''
d_endpwent=''
d_endpwent_r=''
d_endsent=''
d_endservent_r=''
d_eofnblk='define'
d_eunice=''
d_faststdio='define'
d_fchdir=''
d_fchmod=''
d_fchown=''
d_fcntl=''
d_fcntl_can_lock=''
d_fd_macros='define'
d_fd_set='define'
d_fds_bits='define'
d_fgetpos='define'
d_finite=''
d_finitel=''
d_flexfnam='define'
d_flock='define'
d_flockproto='define'
d_fork=''
d_fp_class=''
d_fpathconf=''
d_fpclass=''
d_fpclassify=''
d_fpclassl=''
d_fpos64_t=''
d_frexpl=''
d_fs_data_s=''
d_fseeko=''
d_fsetpos='define'
d_fstatfs=''
d_fstatvfs=''
d_fsync=''
d_ftello=''
d_ftime='define'
d_futimes=''
d_gdbm_ndbm_h_uses_prototypes=''
d_gdbmndbm_h_uses_prototypes=''
d_getaddrinfo=''
d_getcwd='define'
d_getespwnam=''
d_getfsstat=''
d_getgrent=''
d_getgrent_r=''
d_getgrgid_r=''
d_getgrnam_r=''
d_getgrps=''
d_gethbyaddr='define'
d_gethbyname='define'
d_gethent=''
d_gethname='define'
d_gethostbyaddr_r=''
d_gethostbyname_r=''
d_gethostent_r=''
d_gethostprotos='define'
d_getitimer=''
d_getlogin='define'
d_getlogin_r=''
d_getmnt=''
d_getmntent=''
d_getnameinfo=''
d_getnbyaddr=''
d_getnbyname=''
d_getnent=''
d_getnetbyaddr_r=''
d_getnetbyname_r=''
d_getnetent_r=''
d_getnetprotos=''
d_getpagsz=''
d_getpbyname='define'
d_getpbynumber='define'
d_getpent=''
d_getpgid=''
d_getpgrp=''
d_getpgrp2=''
d_getppid=''
d_getprior=''
d_getprotobyname_r=''
d_getprotobynumber_r=''
d_getprotoent_r=''
d_getprotoprotos='define'
d_getprpwnam=''
d_getpwent=''
d_getpwent_r=''
d_getpwnam_r=''
d_getpwuid_r=''
d_getsbyname='define'
d_getsbyport='define'
d_getsent=''
d_getservbyname_r=''
d_getservbyport_r=''
d_getservent_r=''
d_getservprotos='define'
d_getspnam=''
d_getspnam_r=''
d_gettimeod='define'
d_gmtime64=''
d_gmtime_r=''
d_gnulibc=''
d_grpasswd=''
d_hasmntopt=''
d_htonl='define'
d_ilogbl=''
d_inc_version_list=''
d_index=''
d_inetaton=''
d_inetntop=''
d_inetpton=''
d_int64_t=''
d_ipv6_mreq=''
d_isascii='define'
d_isblank=''
d_isfinite=''
d_isinf=''
d_isnan='define'
d_isnanl=''
d_killpg='define'
d_lchown=''
d_ldbl_dig='define'
d_libm_lib_version=''
d_link='define'
d_localtime64=''
d_localtime_r=''
d_localtime_r_needs_tzset=''
d_locconv='define'
d_lockf=''
d_longdbl='define'
d_longlong=''
d_lseekproto='define'
d_lstat=''
d_madvise=''
d_malloc_good_size=''
d_malloc_size=''
d_mblen='define'
d_mbstowcs='define'
d_mbtowc='define'
d_memchr='define'
d_memcmp='define'
d_memcpy='define'
d_memmove='define'
d_memset='define'
d_mkdir='define'
d_mkdtemp=''
d_mkfifo=''
d_mkstemp=''
d_mkstemps=''
d_mktime='define'
d_mktime64=''
d_mmap=''
d_modfl=''
d_modfl_pow32_bug=''
d_modflproto=''
d_mprotect=''
d_msg=''
d_msg_ctrunc=''
d_msg_dontroute=''
d_msg_oob=''
d_msg_peek=''
d_msg_proxy=''
d_msgctl=''
d_msgget=''
d_msghdr_s=''
d_msgrcv=''
d_msgsnd=''
d_msync=''
d_munmap=''
d_mymalloc=''
d_ndbm=''
d_ndbm_h_uses_prototypes=''
d_nice=''
d_nl_langinfo=''
d_nv_preserves_uv='define'
d_nv_zero_is_allbits_zero='define'
d_off64_t=''
d_old_pthread_create_joinable=''
d_oldpthreads=''
d_oldsock=''
d_open3=''
d_pathconf=''
d_pause='define'
d_perl_otherlibdirs=''
d_phostname=''
d_pipe='define'
d_poll=''
d_portable='define'
d_prctl=''
d_prctl_set_name=''
d_printf_format_null=''
d_procselfexe=''
d_pseudofork='define'
d_pthread_atfork=''
d_pthread_attr_setscope=''
d_pthread_yield=''
d_pwage=''
d_pwchange=''
d_pwclass=''
d_pwcomment=''
d_pwexpire=''
d_pwgecos=''
d_pwpasswd=''
d_pwquota=''
d_qgcvt=''
d_quad='define'
d_random_r=''
d_readdir='define'
d_readdir64_r=''
d_readdir_r=''
d_readlink=''
d_readv=''
d_recvmsg=''
d_rename='define'
d_rewinddir='define'
d_rmdir='define'
d_safebcpy=''
d_safemcpy=''
d_sanemcmp='define'
d_sbrkproto=''
d_scalbnl=''
d_sched_yield=''
d_scm_rights=''
d_seekdir='define'
d_select='define'
d_sem=''
d_semctl=''
d_semctl_semid_ds=''
d_semctl_semun=''
d_semget=''
d_semop=''
d_sendmsg=''
d_setegid=''
d_seteuid=''
d_setgrent=''
d_setgrent_r=''
d_setgrps=''
d_sethent=''
d_sethostent_r=''
d_setitimer=''
d_setlinebuf=''
d_setlocale='define'
d_setlocale_r=''
d_setnent=''
d_setnetent_r=''
d_setpent=''
d_setpgid=''
d_setpgrp=''
d_setpgrp2=''
d_setprior=''
d_setproctitle=''
d_setprotoent_r=''
d_setpwent=''
d_setpwent_r=''
d_setregid=''
d_setresgid=''
d_setresuid=''
d_setreuid=''
d_setrgid=''
d_setruid=''
d_setsent=''
d_setservent_r=''
d_setsid=''
d_setvbuf='define'
d_sfio=''
d_shm=''
d_shmat=''
d_shmatprototype=''
d_shmctl=''
d_shmdt=''
d_shmget=''
d_sigaction=''
d_signbit=''
d_sigprocmask=''
d_sigsetjmp=''
d_sin6_scope_id='define'
d_sitearch='define'
d_snprintf='define'
d_sockaddr_in6=''
d_sockaddr_sa_len=''
d_sockatmark=''
d_sockatmarkproto=''
d_socket='define'
d_socklen_t=''
d_sockpair=''
d_socks5_init=''
d_sprintf_returns_strlen='define'
d_sqrtl=''
d_srand48_r=''
d_srandom_r=''
d_sresgproto=''
d_sresuproto=''
d_statblks=''
d_statfs_f_flags=''
d_statfs_s=''
d_static_inline='define'
d_statvfs=''
d_stdio_cnt_lval='define'
d_stdio_ptr_lval='define'
d_stdio_ptr_lval_nochange_cnt='define'
d_stdio_ptr_lval_sets_cnt=''
d_stdio_stream_array=''
d_stdiobase='define'
d_stdstdio='define'
d_strchr='define'
d_strcoll='define'
d_strctcpy='define'
d_strerrm='strerror(e)'
d_strerror='define'
d_strerror_r=''
d_strftime='define'
d_strlcat=''
d_strlcpy=''
d_strtod='define'
d_strtol='define'
d_strtold=''
d_strtoll=''
d_strtoq=''
d_strtoul='define'
d_strtoull=''
d_strtouq=''
d_strxfrm='define'
d_suidsafe=''
d_symlink=''
d_syscall=''
d_syscallproto=''
d_sysconf=''
d_sysernlst=''
d_syserrlst='define'
d_system='define'
d_tcgetpgrp=''
d_tcsetpgrp=''
d_telldir='define'
d_telldirproto='define'
d_time='define'
d_timegm=''
d_times='define'
d_tm_tm_gmtoff=''
d_tm_tm_zone=''
d_tmpnam_r=''
d_truncate=''
d_ttyname_r=''
d_tzname='define'
d_u32align='define'
d_ualarm=''
d_umask='define'
d_uname='define'
d_union_semun='define'
d_unordered=''
d_unsetenv=''
d_usleep=''
d_usleepproto=''
d_ustat=''
d_vendorarch=''
d_vendorbin=''
d_vendorlib=''
d_vendorscript=''
d_vfork=''
d_void_closedir=''
d_voidsig='define'
d_voidtty=''
d_volatile='define'
d_vprintf='define'
d_vsnprintf='define'
d_wait4=''
d_waitpid='define'
d_wcstombs='define'
d_wctomb='define'
d_writev=''
d_xenix=''
date='date'
db_hashtype='int'
db_prefixtype='int'
db_version_major='0'
db_version_minor='0'
db_version_patch='0'
defvoidused='15'
direntrytype='struct direct'
dlext='dll'
dlsrc='dl_win32.xs'
doublesize='8'
drand01='(rand()/(double)((unsigned)1<<RANDBITS))'
drand48_r_proto='0'
dtrace=''
dynamic_ext='B Compress/Raw/Bzip2 Compress/Raw/Zlib Cwd Data/Dumper Devel/PPPort Devel/Peek Digest/MD5 Digest/SHA Encode Fcntl File/Glob Filter/Util/Call Hash/Util Hash/Util/FieldHash IO List/Util MIME/Base64 Math/BigInt/FastCalc Opcode POSIX PerlIO/encoding PerlIO/mmap PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Text/Soundex Tie/Hash/NamedCapture Time/HiRes Time/Piece Unicode/Collate Unicode/Normalize Win32 Win32API/File XS/APItest XS/Typemap arybase attributes mro re threads threads/shared'
eagain='EAGAIN'
ebcdic=''
echo='echo'
egrep='egrep'
emacs=''
endgrent_r_proto='0'
endhostent_r_proto='0'
endnetent_r_proto='0'
endprotoent_r_proto='0'
endpwent_r_proto='0'
endservent_r_proto='0'
eunicefix='​:'
exe_ext='.exe'
expr='expr'
extensions='Archive/Extract Archive/Tar Attribute/Handlers AutoLoader B B/Debug B/Deparse B/Lint CGI CPAN CPAN/Meta CPAN/Meta/YAML CPANPLUS CPANPLUS/Dist/Build Carp Compress/Raw/Bzip2 Compress/Raw/Zlib Cwd Data/Dumper Devel/PPPort Devel/Peek Devel/SelfStubber Digest Digest/MD5 Digest/SHA Dumpvalue Encode Env Errno ExtUtils/CBuilder ExtUtils/Command ExtUtils/Constant ExtUtils/Install ExtUtils/MakeMaker ExtUtils/Manifest ExtUtils/ParseXS Fcntl File/CheckTree File/Fetch File/Glob File/Path File/Temp FileCache Filter/Simple Filter/Util/Call Getopt/Long HTTP/Tiny Hash/Util Hash/Util/FieldHash I18N/Collate I18N/LangTags IO IO/Compress IO/Zlib IPC/Cmd IPC/Open3 JSON/PP List/Util Locale/Codes Locale/Maketext Locale/Maketext/Simple Log/Message Log/Message/Simple MIME/Base64 Math/BigInt Math/BigInt/FastCalc Math/BigRat Math/Complex Memoize Module/Build Module/CoreList Module/Load Module/Load/Conditional Module/Loaded Module/Metadata Module/Pluggable NEXT Net/Ping Object/Accessor Opcode POSIX Package/Constants Params/Check Parse/CPAN/Meta Perl/OSType PerlIO/encoding PerlIO/mmap PerlIO/scalar PerlIO/via PerlIO/via/QuotedPrint Pod/Escapes Pod/Functions Pod/Html Pod/LaTeX Pod/Parser Pod/Perldoc Pod/Simple SDBM_File Safe Search/Dict SelfLoader Socket Storable Sys/Hostname Term/ANSIColor Term/Cap Term/Complete Term/ReadLine Term/UI Test Test/Harness Test/Simple Text/Abbrev Text/Balanced Text/ParseWords Text/Soundex Text/Tabs Thread/Queue Thread/Semaphore Tie/File Tie/Hash/NamedCapture Tie/Memoize Tie/RefHash Time/HiRes Time/Local Time/Piece Unicode/Collate Unicode/Normalize Version/Requirements Win32 Win32API/File Win32CORE XS/APItest XS/Typemap XSLoader arybase attributes autodie autouse base bignum constant encoding/warnings if lib libnet mro parent perlfaq podlators re threads threads/shared'
extern_C='extern'
extras=''
fflushNULL='define'
fflushall=''
find='find'
firstmakefile='makefile'
flex=''
fpossize='8'
fpostype='fpos_t'
freetype='void'
from='​:'
full_ar=''
full_csh=''
full_sed=''
gccansipedantic=''
gccosandvers=''
gccversion=''
getgrent_r_proto='0'
getgrgid_r_proto='0'
getgrnam_r_proto='0'
gethostbyaddr_r_proto='0'
gethostbyname_r_proto='0'
gethostent_r_proto='0'
getlogin_r_proto='0'
getnetbyaddr_r_proto='0'
getnetbyname_r_proto='0'
getnetent_r_proto='0'
getprotobyname_r_proto='0'
getprotobynumber_r_proto='0'
getprotoent_r_proto='0'
getpwent_r_proto='0'
getpwnam_r_proto='0'
getpwuid_r_proto='0'
getservbyname_r_proto='0'
getservbyport_r_proto='0'
getservent_r_proto='0'
getspnam_r_proto='0'
gidformat='"ld"'
gidsign='-1'
gidsize='4'
gidtype='gid_t'
git_branch=''
git_commit_id=''
git_commit_id_title=''
git_describe=''
git_uncommitted_changes=''
glibpth='/usr/shlib /lib/pa1.1 /usr/lib/large /lib /usr/lib /usr/lib/386 /lib/386 /lib/large /usr/lib/small /lib/small /usr/ccs/lib /usr/ucblib /usr/shlib '
gmake='gmake'
gmtime_r_proto='0'
gnulibc_version=''
grep='grep'
groupcat=''
groupstype='gid_t'
gzip='gzip'
h_fcntl='false'
h_sysfile='true'
hint='recommended'
hostcat='ypcat hosts'
html1dir=' '
html1direxp=''
html3dir=' '
html3direxp=''
i16size='2'
i16type='short'
i32size='4'
i32type='long'
i64size='8'
i64type='__int64'
i8size='1'
i8type='char'
i_arpainet='define'
i_assert='define'
i_bsdioctl=''
i_crypt=''
i_db=''
i_dbm=''
i_dirent='define'
i_dld=''
i_dlfcn='define'
i_fcntl='define'
i_float='define'
i_fp=''
i_fp_class=''
i_gdbm=''
i_gdbm_ndbm=''
i_gdbmndbm=''
i_grp=''
i_ieeefp=''
i_inttypes=''
i_langinfo=''
i_libutil=''
i_limits='define'
i_locale='define'
i_machcthr=''
i_malloc='define'
i_mallocmalloc=''
i_math='define'
i_memory=''
i_mntent=''
i_ndbm=''
i_netdb=''
i_neterrno=''
i_netinettcp=''
i_niin=''
i_poll=''
i_prot=''
i_pthread=''
i_pwd=''
i_rpcsvcdbm='define'
i_sfio=''
i_sgtty=''
i_shadow=''
i_socks=''
i_stdarg='define'
i_stdbool=''
i_stddef='define'
i_stdlib='define'
i_string='define'
i_sunmath=''
i_sysaccess=''
i_sysdir=''
i_sysfile=''
i_sysfilio='define'
i_sysin=''
i_sysioctl=''
i_syslog=''
i_sysmman=''
i_sysmode=''
i_sysmount=''
i_sysndir=''
i_sysparam=''
i_syspoll=''
i_sysresrc=''
i_syssecrt=''
i_sysselct=''
i_syssockio=''
i_sysstat='define'
i_sysstatfs=''
i_sysstatvfs=''
i_systime=''
i_systimek=''
i_systimes=''
i_systypes='define'
i_sysuio=''
i_sysun=''
i_sysutsname=''
i_sysvfs=''
i_syswait=''
i_termio=''
i_termios=''
i_time='define'
i_unistd=''
i_ustat=''
i_utime='define'
i_values=''
i_varargs=''
i_varhdr='varargs.h'
i_vfork=''
ignore_versioned_solibs=''
inc_version_list=''
inc_version_list_init='0'
incpath='D​:\MSVStudio\VC98\include'
inews=''
initialinstalllocation=''
installarchlib='c​:\apps\perl-5.16.0\lib'
installbin='c​:\apps\perl-5.16.0\bin'
installhtml1dir=''
installhtml3dir=''
installhtmldir='c​:\apps\perl-5.16.0\html'
installhtmlhelpdir='c​:\apps\perl-5.16.0\htmlhelp'
installman1dir='c​:\apps\perl-5.16.0\man\man1'
installman3dir='c​:\apps\perl-5.16.0\man\man3'
installprefix='c​:\apps\perl-5.16.0'
installprefixexp='c​:\apps\perl-5.16.0'
installprivlib='c​:\apps\perl-5.16.0\lib'
installscript='c​:\apps\perl-5.16.0\bin'
installsitearch='c​:\apps\perl-5.16.0\site\lib'
installsitebin='c​:\apps\perl-5.16.0\bin'
installsitehtml1dir=''
installsitehtml3dir=''
installsitelib='c​:\apps\perl-5.16.0\site\lib'
installsiteman1dir=''
installsiteman3dir=''
installsitescript=''
installstyle='lib'
installusrbinperl=''
installvendorarch=''
installvendorbin=''
installvendorhtml1dir=''
installvendorhtml3dir=''
installvendorlib=''
installvendorman1dir=''
installvendorman3dir=''
installvendorscript=''
intsize='4'
issymlink=''
ivdformat='"ld"'
ivsize='4'
ivtype='long'
known_extensions='B Compress/Raw/Bzip2 Compress/Raw/Zlib Cwd DB_File Data/Dumper Devel/PPPort Devel/Peek Digest/MD5 Digest/SHA Encode Fcntl File/Glob Filter/Util/Call GDBM_File Hash/Util Hash/Util/FieldHash I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Math/BigInt/FastCalc NDBM_File ODBM_File Opcode POSIX PerlIO/encoding PerlIO/mmap PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Text/Soundex Tie/Hash/NamedCapture Time/HiRes Time/Piece Unicode/Collate Unicode/Normalize VMS/DCLsym VMS/Stdio Win32 Win32API/File Win32CORE XS/APItest XS/Typemap arybase attributes mro re threads threads/shared'
ksh=''
ld='link'
lddlflags='-dll -nologo -nodefaultlib -debug -opt​:ref,icf -libpath​:"c​:\apps\perl-5.16.0\lib\CORE" -machine​:x86'
ldflags='-nologo -nodefaultlib -debug -opt​:ref,icf -libpath​:"c​:\apps\perl-5.16.0\lib\CORE" -machine​:x86'
ldflags_nolargefiles='-nologo -nodefaultlib -debug -opt​:ref,icf -libpath​:"c​:\apps\perl-5.16.0\lib\CORE" -machine​:x86'
ldflags_uselargefiles=''
ldlibpthname=''
less='less'
lib_ext='.lib'
libc='msvcrt.lib'
libperl='perl516.lib'
libpth='D​:\MSVStudio\VC98\lib'
libs='oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib'
libs_nolargefiles=''
libsdirs=''
libsfiles=''
libsfound=''
libspath=''
libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun m c cposix posix ndir dir crypt ucb bsd BSD PW x'
libswanted_nolargefiles=''
libswanted_uselargefiles='net socket inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun m c cposix posix ndir dir crypt ucb bsd BSD PW x'
line='line'
lint=''
lkflags=''
ln=''
lns='copy'
localtime_r_proto='0'
locincpth='/usr/local/include /opt/local/include /usr/gnu/include /opt/gnu/include /usr/GNU/include /opt/GNU/include'
loclibpth='/usr/local/lib /opt/local/lib /usr/gnu/lib /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib'
longdblsize='8'
longlongsize='8'
longsize='4'
lp=''
lpr=''
ls='dir'
lseeksize='8'
lseektype='__int64'
mad=''
madlyh=''
madlyobj=''
madlysrc=''
mail=''
mailx=''
make='nmake'
make_set_make='#'
mallocobj='malloc.o'
mallocsrc='malloc.c'
malloctype='void *'
man1dir='c​:\apps\perl-5.16.0\man\man1'
man1direxp='c​:\apps\perl-5.16.0\man\man1'
man1ext='1'
man3dir='c​:\apps\perl-5.16.0\man\man3'
man3direxp='c​:\apps\perl-5.16.0\man\man3'
man3ext='3'
mips_type=''
mistrustnm=''
mkdir='mkdir'
mmaptype='void *'
modetype='mode_t'
more='more /e'
multiarch=''
mv=''
myarchname='MSWin32'
mydomain=''
myhostname=''
myuname=''
n='-n'
need_va_copy=''
netdb_hlen_type='int'
netdb_host_type='char *'
netdb_name_type='char *'
netdb_net_type='long'
nm=''
nm_opt=''
nm_so_opt=''
nonxs_ext='Archive/Extract Archive/Tar Attribute/Handlers AutoLoader B/Debug B/Deparse B/Lint CGI CPAN CPAN/Meta CPAN/Meta/YAML CPANPLUS CPANPLUS/Dist/Build Carp Devel/SelfStubber Digest Dumpvalue Env Errno ExtUtils/CBuilder ExtUtils/Command ExtUtils/Constant ExtUtils/Install ExtUtils/MakeMaker ExtUtils/Manifest ExtUtils/ParseXS File/CheckTree File/Fetch File/Path File/Temp FileCache Filter/Simple Getopt/Long HTTP/Tiny I18N/Collate I18N/LangTags IO/Compress IO/Zlib IPC/Cmd IPC/Open3 JSON/PP Locale/Codes Locale/Maketext Locale/Maketext/Simple Log/Message Log/Message/Simple Math/BigInt Math/BigRat Math/Complex Memoize Module/Build Module/CoreList Module/Load Module/Load/Conditional Module/Loaded Module/Metadata Module/Pluggable NEXT Net/Ping Object/Accessor Package/Constants Params/Check Parse/CPAN/Meta Perl/OSType PerlIO/via/QuotedPrint Pod/Escapes Pod/Functions Pod/Html Pod/LaTeX Pod/Parser Pod/Perldoc Pod/Simple Safe Search/Dict SelfLoader Term/ANSIColor Term/Cap Term/Complete Term/ReadLine Term/UI Test Test/Harness Test/Simple Text/Abbrev Text/Balanced Text/ParseWords Text/Tabs Thread/Queue Thread/Semaphore Tie/File Tie/Memoize Tie/RefHash Time/Local Version/Requirements XSLoader autodie autouse base bignum constant encoding/warnings if lib libnet parent perlfaq podlators'
nroff=''
nvEUformat='"E"'
nvFUformat='"F"'
nvGUformat='"G"'
nv_overflows_integers_at='256.0*256.0*256.0*256.0*256.0*256.0*2.0*2.0*2.0*2.0*2.0'
nv_preserves_uv_bits='32'
nveformat='"e"'
nvfformat='"f"'
nvgformat='"g"'
nvsize='8'
nvtype='double'
o_nonblock='O_NONBLOCK'
obj_ext='.obj'
old_pthread_create_joinable=''
optimize='-MD -Zi -DNDEBUG -O1'
orderlib='false'
osname='MSWin32'
osvers='5.1'
otherlibdirs=''
package='perl5'
pager='more /e'
passcat=''
patchlevel='16'
path_sep=';'
perl='perl'
perl5=''
perl_patchlevel=''
perl_static_inline='static __inline'
perladmin=''
perllibs='oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib'
perlpath='c​:\apps\perl-5.16.0\bin\perl.exe'
pg=''
phostname='hostname'
pidtype='int'
plibpth=''
pmake=''
pr=''
prefix='c​:\apps\perl-5.16.0'
prefixexp='c​:\apps\perl-5.16.0'
privlib='c​:\apps\perl-5.16.0\lib'
privlibexp='D​:\perl-tests\perl-5.16.0\lib'
procselfexe=''
prototype='define'
ptrsize='4'
quadkind='5'
quadtype='__int64'
randbits='15'
randfunc='rand'
random_r_proto='0'
randseedtype='unsigned'
ranlib='rem'
rd_nodata='-1'
readdir64_r_proto='0'
readdir_r_proto='0'
revision='5'
rm='del'
rm_try=''
rmail=''
run=''
runnm='true'
sGMTIME_max='2147483647'
sGMTIME_min='0'
sLOCALTIME_max='2147483647'
sLOCALTIME_min='0'
sPRIEUldbl='"E"'
sPRIFUldbl='"F"'
sPRIGUldbl='"G"'
sPRIXU64='"lX"'
sPRId64='"ld"'
sPRIeldbl='"e"'
sPRIfldbl='"f"'
sPRIgldbl='"g"'
sPRIi64='"li"'
sPRIo64='"lo"'
sPRIu64='"lu"'
sPRIx64='"lx"'
sSCNfldbl='"f"'
sched_yield=''
scriptdir='D​:\perl-tests\perl-5.16.0\bin'
scriptdirexp='c​:\apps\perl-5.16.0\bin'
sed='sed'
seedfunc='srand'
selectminbits='32'
selecttype='Perl_fd_set *'
sendmail='blat'
setgrent_r_proto='0'
sethostent_r_proto='0'
setlocale_r_proto='0'
setnetent_r_proto='0'
setprotoent_r_proto='0'
setpwent_r_proto='0'
setservent_r_proto='0'
sh='cmd /x /c'
shar=''
sharpbang='#!'
shmattype='void *'
shortsize='2'
shrpenv=''
shsharp='true'
sig_count='26'
sig_name='ZERO HUP INT QUIT ILL NUM05 NUM06 NUM07 FPE KILL NUM10 SEGV NUM12 PIPE ALRM TERM NUM16 NUM17 NUM18 NUM19 CHLD BREAK ABRT STOP NUM24 CONT CLD'
sig_name_init='"ZERO", "HUP", "INT", "QUIT", "ILL", "NUM05", "NUM06", "NUM07", "FPE", "KILL", "NUM10", "SEGV", "NUM12", "PIPE", "ALRM", "TERM", "NUM16", "NUM17", "NUM18", "NUM19", "CHLD", "BREAK", "ABRT", "STOP", "NUM24", "CONT", "CLD", 0'
sig_num='0 1 2 21 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 20'
sig_num_init='0, 1, 2, 21, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 20, 0'
sig_size='27'
signal_t='void'
sitearch='c​:\apps\perl-5.16.0\site\lib'
sitearchexp='D​:\perl-tests\perl-5.16.0\site\lib'
sitebin='c​:\apps\perl-5.16.0\site\bin'
sitebinexp='c​:\apps\perl-5.16.0\site\bin'
sitehtml1dir=''
sitehtml1direxp=''
sitehtml3dir=''
sitehtml3direxp=''
sitelib='c​:\apps\perl-5.16.0\site\lib'
sitelib_stem=''
sitelibexp='D​:\perl-tests\perl-5.16.0\site\lib'
siteman1dir=''
siteman1direxp=''
siteman3dir=''
siteman3direxp=''
siteprefix='c​:\apps\perl-5.16.0\site'
siteprefixexp='c​:\apps\perl-5.16.0\site'
sitescript=''
sitescriptexp=''
sizesize='4'
sizetype='size_t'
sleep=''
smail=''
so='dll'
sockethdr=''
socketlib=''
socksizetype='int'
sort='sort'
spackage='Perl5'
spitshell=''
srand48_r_proto='0'
srandom_r_proto='0'
src=''
ssizetype='int'
st_ino_sign='1'
st_ino_size='4'
startperl='#!perl'
startsh='#!/bin/sh'
static_ext='Win32CORE'
stdchar='char'
stdio_base='((fp)->_base)'
stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)'
stdio_cnt='((fp)->_cnt)'
stdio_filbuf=''
stdio_ptr='((fp)->_ptr)'
stdio_stream_array=''
strerror_r_proto='0'
strings='/usr/include/string.h'
submit=''
subversion=''
sysman='/usr/man/man1'
tail=''
tar=''
targetarch=''
tbl=''
tee=''
test=''
timeincl='/usr/include/sys/time.h '
timetype='time_t'
tmpnam_r_proto='0'
to='​:'
touch='touch'
tr=''
trnl='\012'
troff=''
ttyname_r_proto='0'
u16size='2'
u16type='unsigned short'
u32size='4'
u32type='unsigned long'
u64size='8'
u64type='unsigned __int64'
u8size='1'
u8type='unsigned char'
uidformat='"ld"'
uidsign='-1'
uidsize='4'
uidtype='uid_t'
uname='uname'
uniq='uniq'
uquadtype='unsigned __int64'
use5005threads=''
use64bitall=''
use64bitint=''
usecrosscompile=''
usedevel=''
usedl='define'
usedtrace=''
usefaststdio=''
useithreads='define'
usekernprocpathname=''
uselargefiles='define'
uselongdouble=''
usemallocwrap='define'
usemorebits=''
usemultiplicity='define'
usemymalloc='n'
usenm='false'
usensgetexecutablepath=''
useopcode='true'
useperlio='define'
useposix='true'
usereentrant=''
userelocatableinc=''
usesfio='false'
useshrplib='true'
usesitecustomize=''
usesocks=''
usethreads='define'
usevendorprefix=''
usevfork='false'
usrinc='/usr/include'
uuname=''
uvXUformat='"lX"'
uvoformat='"lo"'
uvsize='4'
uvtype='unsigned long'
uvuformat='"lu"'
uvxformat='"lx"'
vaproto=''
vendorarch=''
vendorarchexp=''
vendorbin=''
vendorbinexp=''
vendorhtml1dir=' '
vendorhtml1direxp=''
vendorhtml3dir=' '
vendorhtml3direxp=''
vendorlib=''
vendorlib_stem=''
vendorlibexp=''
vendorman1dir=' '
vendorman1direxp=''
vendorman3dir=' '
vendorman3direxp=''
vendorprefix=''
vendorprefixexp=''
vendorscript=''
vendorscriptexp=''
version='5.16.0'
version_patchlevel_string='version 16 subversion 0'
versiononly=''
vi=''
voidflags='15'
xlibpth='/usr/lib/386 /lib/386'
yacc='yacc'
yaccflags=''
zcat=''
zip='zip'

@p5pRT
Copy link
Author

p5pRT commented Feb 11, 2016

From @mauke

Am 11.02.2016 um 08​:40 schrieb Konovalov@​rt.perl.org​:

# New Ticket Created by Konovalov, Vadim
# Please include the string​: [perl #127512]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=127512 >

This is a bug report for perl from vadim.konovalov@​emc.com,
generated with the help of perlbug 1.39 running under perl 5.16.0.

The lib/strict.pm module contains this check​:

unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) {
# Can't use Carp, since Carp uses us!
my (undef, $f, $l) = caller;
die("Incorrect use of pragma '${\__PACKAGE__}' at $f line $l.\n");
}

The above chunk of code assumes that it is called from a file on
filesystem with a some given extension (.pm or .pmc).

However - this check violates documented behaviour.
Namely, "perldoc -f require" have this explanation​:

=quote
The require function will look for the "Foo​::Bar" file in the
@​INC array and will complain about not finding "Foo​::Bar" there.
In this case you can do​:

      eval "require $class";

Now that you understand how "require" looks for files with a
bareword argument, there is a little extra functionality going
on behind the scenes. Before "require" looks for a ".pm"
extension, it will first look for a similar filename with a
".pmc" extension. If this file is found, it will be loaded in
place of any file ending in a ".pm" extension.

You can also insert hooks into the import facility by putting
Perl code directly into the @​INC array. There are three forms of
hooks​: subroutine references, array references, and blessed
objects.
=cut

Therefore I must be able to place a code ref into @​INC array which
then provide contents of the "strict" module

No. What do you mean by "therefore"? The documentation literally does
not say that.

In other words - the filename check in "strict.pm" contradicts to
this excerpt from documentation.

This deviation from documented behaviour breaks my hand-crafted
mechanism of packaging perl modules into some ZIP file and then
unzipping those at execution time.
(similar to PAR but a bit different)

It doesn't contradict the documentation (and if it did, we'd change the
documentation). The bug is in your "hand-crafted mechanism", not perl.
You've already been told about #line.

--
Lukas Mai <plokinom@​gmail.com>

@p5pRT
Copy link
Author

p5pRT commented Feb 11, 2016

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Feb 11, 2016

From Vadim.Konovalov@emc.com

Le Jeu 11 Fév 2016 07​:12​:24, plokinom@​gmail.com a écrit :

Am 11.02.2016 um 08​:40 schrieb Konovalov@​rt.perl.org​:

# New Ticket Created by Konovalov, Vadim
# Please include the string​: [perl #127512]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=127512 >

This is a bug report for perl from vadim.konovalov@​emc.com,
generated with the help of perlbug 1.39 running under perl 5.16.0.

The lib/strict.pm module contains this check​:

unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) {
# Can't use Carp, since Carp uses us!
my (undef, $f, $l) = caller;
die("Incorrect use of pragma '${\__PACKAGE__}' at $f line $l.\n");
}

The above chunk of code assumes that it is called from a file on
filesystem with a some given extension (.pm or .pmc).

However - this check violates documented behaviour.
Namely, "perldoc -f require" have this explanation​:

=quote
The require function will look for the "Foo​::Bar" file in the
@​INC array and will complain about not finding "Foo​::Bar" there.
In this case you can do​:

      eval "require $class";

Now that you understand how "require" looks for files with a
bareword argument, there is a little extra functionality going
on behind the scenes. Before "require" looks for a ".pm"
extension, it will first look for a similar filename with a
".pmc" extension. If this file is found, it will be loaded in
place of any file ending in a ".pm" extension.

You can also insert hooks into the import facility by putting
Perl code directly into the @​INC array. There are three forms of
hooks​: subroutine references, array references, and blessed
objects.
=cut

Therefore I must be able to place a code ref into @​INC array which
then provide contents of the "strict" module

No. What do you mean by "therefore"? The documentation literally does
not say that.

yes it does states that I can use code ref with @​INC array.

actually - when I wrote my old code - I consulted several places of
documentation, not only "perldoc -f require"

I also consulted "perldoc perlsub", it has advises on how to override
"reuqire" and "do" and I followed advices​:

=quote
...
The built-ins C<do>, C<require> and C<glob> can also be overridden, but due
to special magic, their original syntax is preserved, and you don't have
to define a prototype for their replacements. (You can't override the
C<do BLOCK> syntax, though).
...
=cut

I actually overrid "do", "require" to provide all requieted modules, I was following Perl documentation.

Honestly.

In other words - the filename check in "strict.pm" contradicts to
this excerpt from documentation.

This deviation from documented behaviour breaks my hand-crafted
mechanism of packaging perl modules into some ZIP file and then
unzipping those at execution time.
(similar to PAR but a bit different)

It doesn't contradict the documentation (and if it did, we'd change the
documentation). The bug is in your "hand-crafted mechanism", not perl.

the bug is in Perl - because it does not conform to documented behaviour.

You've already been told about #line.

whether or not I can fix my own "crafted mechanism" by inserting #line here and there - there's another question.

I state that when I wrote mentioned code - I closely followed perl documentatiom, I am good perl citizen who did "perldoc" often.
Documentation on overriding "CORE​::GLOBAL​::require" does not state that I must insert #line when I feed "srtict.pm" and "warnings.pm" contents out of my pocket.

New behaviour makes my old mechanism catched by trap - in spite of some other users who are now more happy by being warned more often.
Ok, but why they are prefered over me?

@p5pRT
Copy link
Author

p5pRT commented Feb 12, 2016

From Vadim.Konovalov@emc.com

attached patches remove an assumption that strict.pm (and warnings.pm) must reside on a file on a filesystem,
thus allowing those to be fed to perl interpreter by other means (e.g. with eval)

Still, "use Strict" possible user error detected, plus regular expression made simplier and thus easier to comprehend.

Yet, moved the check few lines to the bottom.

thanks in advance for considering these.

@p5pRT
Copy link
Author

p5pRT commented Feb 12, 2016

From Vadim.Konovalov@emc.com

Inline Patch
--- strict.pm-	2016-01-08 18:22:20.246454624 +0000
+++ strict.pm	2016-02-12 03:25:03.983559206 +0000
@@ -2,13 +2,6 @@
 
 $strict::VERSION = "1.09";
 
-# Verify that we're called correctly so that strictures will work.
-unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) {
-    # Can't use Carp, since Carp uses us!
-    my (undef, $f, $l) = caller;
-    die("Incorrect use of pragma '${\__PACKAGE__}' at $f line $l.\n");
-}
-
 my ( %bitmask, %explicit_bitmask );
 
 BEGIN {
@@ -35,6 +28,14 @@
 
     my $inline_all_explicit_bits = $bits;
     *all_explicit_bits = sub () { $inline_all_explicit_bits };
+
+    # Verify that we're called correctly so that strictures will work.
+    if ( __FILE__ =~ /(\w+)\.pmc?$/ and $1 ne __PACKAGE__ ) {
+        # Can't use Carp, since Carp uses us!
+        my (undef, $f, $l) = caller;
+        die("Incorrect use of pragma '${\__PACKAGE__}' at $f line $l.\n");
+    }
+
 }
 
 sub bits {

@p5pRT
Copy link
Author

p5pRT commented Feb 12, 2016

From Vadim.Konovalov@emc.com

Inline Patch
--- warnings.pl-	2015-10-30 20:21:20.000000000 +0000
+++ warnings.pl	2016-02-12 03:38:13.493006659 +0000
@@ -16,7 +16,7 @@
 #
 # This script is normally invoked from regen.pl.
 
-$VERSION = '1.34';
+$VERSION = '1.35';
 
 BEGIN {
     require 'regen/regen_lib.pl';
@@ -494,7 +494,7 @@
 
 # Verify that we're called correctly so that warnings will work.
 # see also strict.pm.
-unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) {
+if ( __FILE__ =~ /(\w+).pmc?$/ and $1 ne __PACKAGE__ ) {
     my (undef, $f, $l) = caller;
     die("Incorrect use of pragma '${\__PACKAGE__}' at $f line $l.\n");
 }

@p5pRT
Copy link
Author

p5pRT commented Feb 12, 2016

From Vadim.Konovalov@emc.com

...better patch

@p5pRT
Copy link
Author

p5pRT commented Feb 12, 2016

From Vadim.Konovalov@emc.com

Inline Patch
--- strict.pm-	2016-01-08 18:22:20.246454624 +0000
+++ strict.pm	2016-02-12 03:31:52.792023871 +0000
@@ -1,13 +1,6 @@
 package strict;
 
-$strict::VERSION = "1.09";
-
-# Verify that we're called correctly so that strictures will work.
-unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) {
-    # Can't use Carp, since Carp uses us!
-    my (undef, $f, $l) = caller;
-    die("Incorrect use of pragma '${\__PACKAGE__}' at $f line $l.\n");
-}
+$strict::VERSION = "1.10";
 
 my ( %bitmask, %explicit_bitmask );
 
@@ -35,6 +28,14 @@
 
     my $inline_all_explicit_bits = $bits;
     *all_explicit_bits = sub () { $inline_all_explicit_bits };
+
+    # Verify that we're called correctly so that strictures will work.
+    if ( __FILE__ =~ /(\w+)\.pmc?$/ and $1 ne __PACKAGE__ ) {
+        # Can't use Carp, since Carp uses us!
+        my (undef, $f, $l) = caller;
+        die("Incorrect use of pragma '${\__PACKAGE__}' at $f line $l.\n");
+    }
+
 }
 
 sub bits {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants