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

use subs 'xx'; should be identical to sub xx; #16054

Open
p5pRT opened this issue Jun 28, 2017 · 5 comments
Open

use subs 'xx'; should be identical to sub xx; #16054

p5pRT opened this issue Jun 28, 2017 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 28, 2017

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

Searchable as RT131671$

@p5pRT
Copy link
Author

p5pRT commented Jun 28, 2017

From the.rob.dixon@gmail.com

This is a bug report for perl from the.rob.dixon@​gmail.com,
generated with the help of perlbug 1.40 running under perl 5.24.0.


The documentation for `subs` doesn't suggest anything beyond
pre-declaration of the named subroutines. But that is what
`sub x` is supposed to do.

`use subs` is a pair with `use vars`, and I think both should be
deprecated, but that is a different problem.

This program

  sub unlink;
  unlink 'path';

produces

  Ambiguous call resolved as CORE​::unlink()

whereas

  use subs 'unlink';
  unlink 'path';

gives

  Undefined subroutine &main​::unlink called

I believe that the second behaviour is correct, and the
first code example should produce the same result.



Flags​:
  category=core
  severity=low


Site configuration information for perl 5.24.0​:

Configured by strawberry-perl at Tue May 10 21​:33​:22 2016.

Summary of my perl5 (revision 5 version 24 subversion 0) configuration​:

  Platform​:
  osname=MSWin32, osvers=6.3, archname=MSWin32-x64-multi-thread
  uname='Win32 strawberry-perl 5.24.0.1 #1 Tue May 10 21​:30​:49 2016 x64'
  config_args='undef'
  hint=recommended, useposix=true, d_sigaction=undef
  useithreads=define, usemultiplicity=define
  use64bitint=define, use64bitall=undef, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='gcc', ccflags =' -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE
-DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
-fwrapv -fno-strict-aliasing -mms-bitfields',
  optimize='-s -O2',
  cppflags='-DWIN32'
  ccversion='', gccversion='4.9.2', gccosandvers=''
  intsize=4, longsize=4, ptrsize=8, doublesize=8, byteorder=12345678,
doublekind=3
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16,
longdblkind=3
  ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='long
long', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='g++', ldflags ='-s -L"C​:\strawberry\perl\lib\CORE"
-L"C​:\strawberry\c\lib"'
  libpth=C​:\strawberry\c\lib C​:\strawberry\c\x86_64-w64-mingw32\lib
C​:\strawberry\c\lib\gcc\x86_64-w64-mingw32\4.9.2
  libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32
-ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr
-lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
  perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32
-ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr
-lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
  libc=, so=dll, useshrplib=true, libperl=libperl524.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_win32.xs, dlext=xs.dll, d_dlsymun=undef, ccdlflags=' '
  cccdlflags=' ', lddlflags='-mdll -s -L"C​:\strawberry\perl\lib\CORE"
-L"C​:\strawberry\c\lib"'


@​INC for perl 5.24.0​:
  C​:/Strawberry/perl/site/lib/MSWin32-x64-multi-thread
  C​:/Strawberry/perl/site/lib
  C​:/Strawberry/perl/vendor/lib
  C​:/Strawberry/perl/lib
  .


Environment for perl 5.24.0​:
  HOME (unset)
  LANG (unset)
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=C​:\ProgramData\Oracle\Java\javapath;C​:\PHP\;C​:\Program Files
(x86)\NVIDIA
Corporation\PhysX\Common;C​:\WINDOWS\system32;C​:\WINDOWS;C​:\WINDOWS\System32\Wbem;C​:\WINDOWS\System32\WindowsPowerShell\v1.0\;C​:\Strawberry\perl\bin;C​:\Strawberry\perl\site\bin;C​:\Strawberry\c\bin;C​:\Python27\;C​:\Python27\Scripts;E​:\Perl\source\public;C​:\ProgramData\chocolatey\bin;C​:\Program
Files\Git\cmd;C​:\ffmpeg\bin;C​:\SQLite;C​:\PHP;C​:\Program Files (x86)\Windows
Kits\8.1\Windows Performance
Toolkit\;C​:\tools\php;C​:\rakudo\bin;C​:\rakudo\share\perl6\site\bin;C​:\tidy-5.2.0-win64\bin;C​:\Program
Files
(x86)\GnuWin32\bin;C​:\CUETools;C​:\aria2;C​:\adb;C​:\tools\php;C​:\rakudo\bin;C​:\rakudo\share\perl6\site\bin;C​:\tidy-5.2.0-win64\bin;C​:\Program
Files
(x86)\GnuWin32\bin;C​:\CUETools;C​:\aria2;C​:\xpdfbin-win-3.04\bin64;C​:\aria2;C​:\Program
Files\7-Zip
  PERL_BADLANG (unset)
  SHELL (unset)

@p5pRT
Copy link
Author

p5pRT commented Dec 6, 2018

From @jkeenan

On Wed, 28 Jun 2017 18​:00​:43 GMT, the.rob.dixon@​gmail.com wrote​:

This is a bug report for perl from the.rob.dixon@​gmail.com,
generated with the help of perlbug 1.40 running under perl 5.24.0.

-----------------------------------------------------------------

The documentation for `subs` doesn't suggest anything beyond
pre-declaration of the named subroutines. But that is what
`sub x` is supposed to do.

`use subs` is a pair with `use vars`, and I think both should be
deprecated, but that is a different problem.

This program

sub unlink;
unlink 'path';

produces

Ambiguous call resolved as CORE​::unlink()

whereas

use subs 'unlink';
unlink 'path';

gives

Undefined subroutine &main​::unlink called

I believe that the second behaviour is correct, and the
first code example should produce the same result.

When running the first program (attached as 131671-a-subs.pl), I don't get the result you report. Instead, the program runs and exits silently.

#####
$ cat 131671-a-subs.pl
sub unlink;
unlink 'path';
$ perl 131671-a-subs.pl
$
#####

Your second program​:

#####
$ cat 131671-subs.pl
use subs 'unlink';
unlink 'path';
$ perl 131671-subs.pl
Undefined subroutine &main​::unlink called at 131671-subs.pl line 2.
#####

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Dec 6, 2018

From @jkeenan

131671-a-subs.pl

@p5pRT
Copy link
Author

p5pRT commented Dec 6, 2018

From @jkeenan

131671-subs.pl

@p5pRT
Copy link
Author

p5pRT commented Dec 6, 2018

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

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