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

warnings.pm provides no way to specify the call frame #16257

Closed
p5pRT opened this issue Nov 20, 2017 · 7 comments
Closed

warnings.pm provides no way to specify the call frame #16257

p5pRT opened this issue Nov 20, 2017 · 7 comments
Labels

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented Nov 20, 2017

Migrated from rt.perl.org#132468 (status was 'resolved')

Searchable as RT132468$

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Nov 20, 2017

From @cpansprout

warnings.pm’s functions, warnings​::enabled, warnings​::warnif, etc., do not provide sufficiently fine-grained control over which call frame’s bitmask is looked at, which is why DBM​::Deep fiddles with the bitmasks itself, and is currently broken with blead.

I would like to propose that every warnings​:: function that accepts a $category/$object also take an optional numeric argument following it specifying the precise number of call frames.

That way, DBM​::Deep will no longer have to use such brittle code for future perl versions.

In more detail​:

warnings​::enabled()
warnings​::enabled($category)
warnings​::enabled($category,$level) # this is new

warnings​::fatal_enabled()
warnings​::fatal_enabled($category)
warnings​::fatal_enabled($category,$level) # this is new

warnings​::warn($message)
warnings​::warn($category,$message)
warnings​::warn($category,$level,$message) # this is new

warnings​::warnif($message)
warnings​::warnif($category,$message)
warnings​::warnif($category,$level,$message) # this is new

perl -V output, which is somewhat irrelevant to this proposal​:

Summary of my perl5 (revision 5 version 27 subversion 6) configuration​:
  Derived from​: 98acbca
  Platform​:
  osname=darwin
  osvers=12.5.0
  archname=darwin-2level
  uname='darwin pint.local 12.5.0 darwin kernel version 12.5.0​: sun sep 29 13​:33​:47 pdt 2013; root​:xnu-2050.48.12~1release_x86_64 x86_64 '
  config_args='-de -Dusedevel'
  hint=recommended
  useposix=true
  d_sigaction=define
  useithreads=undef
  usemultiplicity=undef
  use64bitint=define
  use64bitall=define
  uselongdouble=undef
  usemymalloc=n
  default_inc_excludes_dot=define
  bincompat5005=undef
  Compiler​:
  cc='cc'
  ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.8 -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include -DPERL_USE_SAFE_PUTENV'
  optimize='-O3'
  cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.8 -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include'
  ccversion=''
  gccversion='4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.27)'
  gccosandvers=''
  intsize=4
  longsize=8
  ptrsize=8
  doublesize=8
  byteorder=12345678
  doublekind=3
  d_longlong=define
  longlongsize=8
  d_longdbl=define
  longdblsize=16
  longdblkind=3
  ivtype='long'
  ivsize=8
  nvtype='double'
  nvsize=8
  Off_t='off_t'
  lseeksize=8
  alignbytes=8
  prototype=define
  Linker and Libraries​:
  ld='cc'
  ldflags =' -mmacosx-version-min=10.8 -fstack-protector -L/usr/local/lib -L/opt/local/lib'
  libpth=/usr/local/lib /usr/bin/../lib/clang/4.2/lib /usr/lib /opt/local/lib
  libs=-lpthread -ldbm -ldl -lm -lutil -lc
  perllibs=-lpthread -ldl -lm -lutil -lc
  libc=
  so=dylib
  useshrplib=false
  libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs
  dlext=bundle
  d_dlsymun=undef
  ccdlflags=' '
  cccdlflags=' '
  lddlflags=' -mmacosx-version-min=10.8 -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib -fstack-protector'

Characteristics of this binary (from libperl)​:
  Compile-time options​:
  HAS_TIMES
  PERLIO_LAYERS
  PERL_COPY_ON_WRITE
  PERL_DONT_CREATE_GVSV
  PERL_MALLOC_WRAP
  PERL_OP_PARENT
  PERL_PRESERVE_IVUV
  PERL_USE_DEVEL
  PERL_USE_SAFE_PUTENV
  USE_64_BIT_ALL
  USE_64_BIT_INT
  USE_LARGE_FILES
  USE_LOCALE
  USE_LOCALE_COLLATE
  USE_LOCALE_CTYPE
  USE_LOCALE_NUMERIC
  USE_LOCALE_TIME
  USE_PERLIO
  USE_PERL_ATOF
  Locally applied patches​:
  uncommitted-changes
  Built under darwin
  Compiled at Nov 14 2017 16​:22​:53
  @​INC​:
  lib
  /usr/local/lib/perl5/site_perl/5.27.6/darwin-2level
  /usr/local/lib/perl5/site_perl/5.27.6
  /usr/local/lib/perl5/5.27.6/darwin-2level
  /usr/local/lib/perl5/5.27.6
  /usr/local/lib/perl5/site_perl

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Nov 20, 2017

From @arc

Father Chrysostomos <perlbug-followup@​perl.org> wrote​:

warnings​::enabled()
warnings​::enabled($category)
warnings​::enabled($category,$level) # this is new

warnings​::fatal_enabled()
warnings​::fatal_enabled($category)
warnings​::fatal_enabled($category,$level) # this is new

warnings​::warn($message)
warnings​::warn($category,$message)
warnings​::warn($category,$level,$message) # this is new

warnings​::warnif($message)
warnings​::warnif($category,$message)
warnings​::warnif($category,$level,$message) # this is new

I think it would be better to use new names for the functions taking a
level, rather than further overloading the existing names. Here is one
set of straw-man possibilities (though I'm much more interested in
picking *any* new names than these particular ones)​:

warnings​::enabled_at_level
warnings​::fatal_enabled_at_level
warnings​::warn_for_level
warnings​::warnif_for_level

--
Aaron Crane

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Nov 20, 2017

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

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Dec 10, 2017

From @cpansprout

On Mon, 20 Nov 2017 01​:56​:29 -0800, arc wrote​:

Father Chrysostomos <perlbug-followup@​perl.org> wrote​:

warnings​::enabled()
warnings​::enabled($category)
warnings​::enabled($category,$level) # this is new

warnings​::fatal_enabled()
warnings​::fatal_enabled($category)
warnings​::fatal_enabled($category,$level) # this is new

warnings​::warn($message)
warnings​::warn($category,$message)
warnings​::warn($category,$level,$message) # this is new

warnings​::warnif($message)
warnings​::warnif($category,$message)
warnings​::warnif($category,$level,$message) # this is new

I think it would be better to use new names for the functions taking a
level, rather than further overloading the existing names. Here is one
set of straw-man possibilities (though I'm much more interested in
picking *any* new names than these particular ones)​:

warnings​::enabled_at_level
warnings​::fatal_enabled_at_level
warnings​::warn_for_level
warnings​::warnif_for_level

I think _at_ would make sense for all four, since the warning will say ‘at xxx line xxx’.

If nobody objects, I will go ahead and implement _at_level versions of these soonish.

--

Father Chrysostomos

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Dec 18, 2017

From @cpansprout

On Sun, 10 Dec 2017 14​:54​:46 -0800, sprout wrote​:

If nobody objects, I will go ahead and implement _at_level versions of
these soonish.

As threatened, I have implemented this in commit c4583f5.

--

Father Chrysostomos

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Dec 18, 2017

From [Unknown Contact. See original ticket]

On Sun, 10 Dec 2017 14​:54​:46 -0800, sprout wrote​:

If nobody objects, I will go ahead and implement _at_level versions of
these soonish.

As threatened, I have implemented this in commit c4583f5.

--

Father Chrysostomos

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Dec 18, 2017

@cpansprout - Status changed from 'open' to 'resolved'

@p5pRT p5pRT closed this Dec 18, 2017
@p5pRT p5pRT added the Severity Low label Oct 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.