Skip Menu |

This queue is for tickets about the Tcl CPAN distribution.

Report information
The Basics
Id: 125408
Status: resolved
Priority: 0/
Queue: Tcl

People
Owner: Nobody in particular
Requestors: sjaluo [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.05
Fixed in: 1.06



Subject: Empty message on tcl error
Hi, If there is any occurs on tcl execution, the error message might be an empty string, as following steps: $ perl -MTcl -e 'Tcl->new->call("foo");' Tcl error '' while invoking scalar result call: "foo" at -e line 1. After some tracing, I found there is an issue that $@ would be destroyed on 'require Carp'. Here attaches a small patch to fix the issue. System information: $ perl -v This is perl 5, version 26, subversion 2 (v5.26.2) built for x86_64-cygwin-threads-multi (with 7 registered patches, see perl -V for more detail)
Subject: tcl-errmsg.patch
--- Tcl.pm.bak 2018-05-27 13:14:41.902373100 +0800 +++ Tcl.pm 2018-05-27 13:17:38.431470000 +0800 @@ -575,8 +575,9 @@ my @res; eval { @res = $interp->icall(@args); }; if ($@) { + my $errmsg = $@; # 'require Carp' might destroy $@; require Carp; - Carp::croak ("Tcl error '$@' while invoking array result call:\n" . + Carp::croak ("Tcl error '$errmsg' while invoking array result call:\n" . "\t\"@args\""); } return @res; @@ -584,8 +585,9 @@ my $res; eval { $res = $interp->icall(@args); }; if ($@) { + my $errmsg = $@; # 'require Carp' might destroy $@; require Carp; - Carp::croak ("Tcl error '$@' while invoking scalar result call:\n" . + Carp::croak ("Tcl error '$errmsg' while invoking scalar result call:\n" . "\t\"@args\""); } return $res; @@ -719,8 +721,9 @@ sub DELETE { my $obj = shift; unless (@{$obj} == 2 || @{$obj} == 3) { + my @args = @_; require Carp; - Carp::croak("STORE Usage: objdata @{$obj} $#{$obj}, not 2 or 3 (@_)"); + Carp::croak("STORE Usage: objdata @{$obj} $#{$obj}, not 2 or 3 (@args)"); } my ($interp, $varname, $flags) = @{$obj}; my ($str1) = @_;
TYVM!