[perl #117097] [BUG] say $!.WHAT fails in CATCH block

2015-11-28 Thread Christian Bartolomaeus via RT
On Sat Nov 28 07:49:05 2015, barto...@gmx.de wrote:
> There was a short discussion on #perl6 about this recently:
> http://irclog.perlgeek.de/perl6/2015-11-17#i_11554013
> 
> ZoffixW How come $! is empty?
> m: my ( $v1, $op, $v2 ) = (2, '-', "zoffix"); my $x =
> try { EVAL "$v1 $op $v2"; CATCH { fail "Invalid operand to Color: Got
> error $!" } }; say $x
> camelia rakudo-moar a662e0: OUTPUT«Use of Nil in string
> context  in block  at /tmp/Dg9t65PMrW:1␤===SORRY!===␤Invalid operand
> to Color: Got error ␤»
> * ZoffixW   is going by http://learnxinyminutes.com/docs/perl6/
> that $! should contain the error message in that case
> Um. never mind.
> pschm: my ( $v1, $op, $v2 ) = (2, '-', "zoffix"); my $x =
> try { EVAL "$v1 $op $v2"; }; say $!
> camelia rakudo-moar a662e0: OUTPUT«5===SORRY!5=== Error while
> compiling /home/camelia/EVAL_0␤Undeclared routine:␤zoffix used at
> line 1␤␤»
> * ZoffixW   is really lost
> psch$! is set after the CATCH, inside you get $_
> not sure if that's correct though, but it's what's
> impl'd
> ZoffixW Ah, thanks psch++

And as a follow up: http://irclog.perlgeek.de/perl6/2015-11-17#i_11554347

vendethielbut perhaps someone who knows the rules of CATCH a bit more than 
I do can confirm what psch++ 
  said http://irclog.perlgeek.de/perl6/2015-11-17#i_11554028
jnthn vendethiel: Believe so. It's $_ inside of CATCH 'cus you want to 
be able to smartmatch on it



[perl #117097] [BUG] say $!.WHAT fails in CATCH block

2015-11-28 Thread Christian Bartolomaeus via RT
There was a short discussion on #perl6 about this recently: 
http://irclog.perlgeek.de/perl6/2015-11-17#i_11554013

ZoffixW How come $! is empty?
m: my ( $v1, $op, $v2 ) = (2, '-', "zoffix"); my $x = try { 
EVAL "$v1 $op $v2"; CATCH { fail "Invalid operand to Color: Got error $!" } }; 
say $x
camelia rakudo-moar a662e0: OUTPUT«Use of Nil in string context  in 
block  at /tmp/Dg9t65PMrW:1␤===SORRY!===␤Invalid operand to Color: Got error ␤»
* ZoffixW   is going by http://learnxinyminutes.com/docs/perl6/ that $! 
should contain the error message in that case
Um. never mind.
pschm: my ( $v1, $op, $v2 ) = (2, '-', "zoffix"); my $x = try { 
EVAL "$v1 $op $v2"; }; say $!
camelia rakudo-moar a662e0: OUTPUT«5===SORRY!5=== Error while compiling 
/home/camelia/EVAL_0␤Undeclared routine:␤zoffix used at line 1␤␤»
* ZoffixW   is really lost
psch$! is set after the CATCH, inside you get $_
not sure if that's correct though, but it's what's impl'd
ZoffixW Ah, thanks psch++


[perl #117097] [BUG] say $!.WHAT fails in CATCH block

2014-10-15 Thread Christian Bartolomaeus via RT
say $!.WHAT in CATCH block no longer dies, but it gives Nil. The exception is 
available in $_:

$ perl6-m -e '{ die 42; CATCH { say $!.WHAT; say $_.perl } }'
Nil
X::AdHoc.new(payload = 42)
42
  in block unit at -e:1

S04/Exception handlers says An exception handler is just a switch statement on 
an implicit topic that happens to be the current exception to be dealt with. 
Inside the CATCH block, the exception in question is bound to $_.

Maybe someone can clarify whether the exception should also be in $! at that 
time.