Skip Menu |
Report information
Id: 132976
Status: new
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: Ulrich.Windl [at] rz.uni-regensburg.de
Cc:
AdminCc:

Operating System: Linux
PatchStatus: (no value)
Severity: Wishlist
Type: core
Perl Version: 5.18.2
Fixed In: (no value)



To: <perlbug [...] perl.org>
Subject: enhancement proposal for caller()
Date: Wed, 14 Mar 2018 08:57:08 +0100
From: "Ulrich Windl" <Ulrich.Windl [...] rz.uni-regensburg.de>
Download (untitled) / with headers
text/plain 4.6k
This is a bug report for perl from Ulrich.Windl@rz.uni-regensburg.de, generated with the help of perlbug 1.39 running under perl 5.18.2. ----------------------------------------------------------------- I had the need to find out whether my die handler is receiving messages from a require or use, so I used caller(). Unfortunately caller() is less comfortable to use that other Perl functions. For example when I need to inspect a "slice" of all stack frames, I'll have to call caller() repeatedly to find out the depth of the call stack, and then inspect all the lists for the desired elements. What I'd like to get from caller() is: 1) The actual depth of the call stack 2) All call frames, not just one 3) A "slice" of a selection of call stacks Possible implementations could be: caller(-1) returns a list with array references to all call frames Maybe better: Add a new callers() that returns all call frames like caller(-1) above. If given a list of numeric arguments, the result is restricted to the columns ("slices") given. So grep { $_->[0] } callers(7) would find all the is_require colums. Maybe if just one column is requested, the result could be a simple list instead a list of single-element lists. callers()[0] would be top or bottom of the call stack, and callers()[-1] the other end... I hope you get the idea. [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=wishlist --- This perlbug was built using Perl 5.18.2 - Fri Nov 24 17:17:29 UTC 2017 It is being executed now by Perl 5.18.2 - Fri Nov 24 17:15:01 UTC 2017. Site configuration information for perl 5.18.2: Configured by abuild at Fri Nov 24 17:15:01 UTC 2017. Summary of my perl5 (revision 5 version 18 subversion 2) configuration: Platform: osname=linux, osvers=4.4.92-31-default, archname=x86_64-linux-thread-multi uname='linux build70 4.4.92-31-default #1 smp sun oct 22 06:56:24 utc 2017 (1d80e8a) x86_64 x86_64 x86_64 gnulinux ' config_args='-ds -e -Dprefix=/usr -Dvendorprefix=/usr -Dinstallusrbinperl -Dusethreads -Di_db -Di_dbm -Di_ndbm -Di_gdbm -Dd_dbm_open -Duseshrplib=true -Doptimize=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -Wall -pipe -Accflags=-DPERL_USE_SAFE_PUTENV -Dotherlibdirs=/usr/lib/perl5/site_perl -Dinc_version_list=5.18.0/x86_64-linux-thread-multi 5.18.0 5.18.1/x86_64-linux-thread-multi 5.18.1' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -Wall -pipe', cppflags='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -fstack-protector' ccversion='', gccversion='4.8.5', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib64 -fstack-protector' libpth=/lib64 /usr/lib64 /usr/local/lib64 libs=-lm -ldl -lcrypt -lpthread perllibs=-lm -ldl -lcrypt -lpthread libc=/lib64/libc-2.22.so, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.22' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.18.2/x86_64-linux-thread-multi/CORE' cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib64 -fstack-protector' Locally applied patches: --- @INC for perl 5.18.2: /usr/lib/perl5/site_perl/5.18.2/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.18.2 /usr/lib/perl5/vendor_perl/5.18.2/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.18.2 /usr/lib/perl5/5.18.2/x86_64-linux-thread-multi /usr/lib/perl5/5.18.2 /usr/lib/perl5/site_perl --- Environment for perl 5.18.2: HOME=/home/user LANG=en_US.UTF-8 LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/user/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games PERL_BADLANG (unset) SHELL=/bin/bash


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org