debugger dies on me
Hi perl6people, I am trying to debug with rakudo star 2016.11 and get the message below. I got the same message with 2016.9. Any suggestions? Unhandled exception: ctxlexpad needs an MVMContext at SETTING::src/core/PseudoStash.pm:45 (/home/theo/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm:) from SETTING::src/core/PseudoStash.pm:156 (/home/theo/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm:AT-KEY) from SETTING::src/core/hash_slice.pm:6 (/home/theo/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm:postcircumfix:<{ }>) from site#sources/3E687CA5BFB386524F923BAC2F986CC3C66BD24F (Debugger::UI::CommandLine):736 (/media/theo/A224A15B24A13369/Users/Public/work/lector/example/lib/.precomp/15864B3E1C12EDF795F35FA29E098427159D2514.1480934859.92858/3E/3E687CA5BFB386524F923BAC2F986CC3C66BD24F:) from SETTING::src/core/Any-iterable-methods.pm:462 (/home/theo/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm:) from SETTING::src/core/Any-iterable-methods.pm:440 (/home/theo/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm:sink-all) from SETTING::src/core/Seq.pm:158 (/home/theo/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm:sink) from site#sources/3E687CA5BFB386524F923BAC2F986CC3C66BD24F (Debugger::UI::CommandLine):730 (/media/theo/A224A15B24A13369/Users/Public/work/lector/example/lib/.precomp/15864B3E1C12EDF795F35FA29E098427159D2514.1480934859.92858/3E/3E687CA5BFB386524F923BAC2F986CC3C66BD24F:unhandled) from site#sources/3E687CA5BFB386524F923BAC2F986CC3C66BD24F (Debugger::UI::CommandLine):721 (/media/theo/A224A15B24A13369/Users/Public/work/lector/example/lib/.precomp/15864B3E1C12EDF795F35FA29E098427159D2514.1480934859.92858/3E/3E687CA5BFB386524F923BAC2F986CC3C66BD24F:) from gen/moar/Metamodel.nqp:3990 (/home/theo/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Metamodel.moarvm:enter) from SETTING::src/core/Routine.pm:85 (/home/theo/.rakudobrew/moar-nom/install/share/perl6/runtime/CORE.setting.moarvm:CALL-ME) from gen/moar/BOOTSTRAP.nqp:2961 (/home/theo/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/BOOTSTRAP.moarvm:) from gen/moar/stage2/NQPHLL.nqp:1667 (/home/theo/.rakudobrew/moar-nom/install/share/nqp/lib/NQPHLL.moarvm:command_eval) from src/Perl6/Compiler.nqp:27 (/home/theo/.rakudobrew/moar-nom/install/share/nqp/lib/Perl6/Compiler.moarvm:command_eval) from gen/moar/stage2/NQPHLL.nqp:1607 (/home/theo/.rakudobrew/moar-nom/install/share/nqp/lib/NQPHLL.moarvm:command_line) from gen/moar/perl6-debug.nqp:508 (/home/theo/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6-debug.moarvm:MAIN) from gen/moar/perl6-debug.nqp:439 (/home/theo/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6-debug.moarvm:) from :1 (/home/theo/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6-debug.moarvm:) from :1 (/home/theo/.rakudobrew/moar-nom/install/share/perl6/runtime/perl6-debug.moarvm:) thanks, -- Theo van den Heuvel Van den Heuvel HLT Consultancy
Re: debugger dies on me
I can see references to /home/theo/.rakudobrew which shouldn't exist if you were using Rakudo Star on its own. Looks like you have mixed up two versions. S On 5 December 2016 at 11:22, Theo van den Heuvel wrote: > > Hi perl6people, > > I am trying to debug with rakudo star 2016.11 and get the message below. I > got the same message with 2016.9. Any suggestions? > > > Unhandled exception: ctxlexpad needs an MVMContext >at SETTING::src/core/PseudoStash.pm:45 (/home/theo/.rakudobrew/moar-n > om/install/share/perl6/runtime/CORE.setting.moarvm:) > from SETTING::src/core/PseudoStash.pm:156 (/home/theo/.rakudobrew/moar-n > om/install/share/perl6/runtime/CORE.setting.moarvm:AT-KEY) > from SETTING::src/core/hash_slice.pm:6 (/home/theo/.rakudobrew/moar-n > om/install/share/perl6/runtime/CORE.setting.moarvm:postcircumfix:<{ }>) > from site#sources/3E687CA5BFB386524F923BAC2F986CC3C66BD24F > (Debugger::UI::CommandLine):736 (/media/theo/A224A15B24A13369/ > Users/Public/work/lector/example/lib/.precomp/15864B3E1C12ED > F795F35FA29E098427159D2514.1480934859.92858/3E/3E687CA5BF > B386524F923BAC2F986CC3C66BD24F:) > from SETTING::src/core/Any-iterable-methods.pm:462 > (/home/theo/.rakudobrew/moar-nom/install/share/perl6/runtime > /CORE.setting.moarvm:) > from SETTING::src/core/Any-iterable-methods.pm:440 > (/home/theo/.rakudobrew/moar-nom/install/share/perl6/runtime > /CORE.setting.moarvm:sink-all) > from SETTING::src/core/Seq.pm:158 (/home/theo/.rakudobrew/moar-n > om/install/share/perl6/runtime/CORE.setting.moarvm:sink) > from site#sources/3E687CA5BFB386524F923BAC2F986CC3C66BD24F > (Debugger::UI::CommandLine):730 (/media/theo/A224A15B24A13369/ > Users/Public/work/lector/example/lib/.precomp/15864B3E1C12ED > F795F35FA29E098427159D2514.1480934859.92858/3E/3E687CA5BF > B386524F923BAC2F986CC3C66BD24F:unhandled) > from site#sources/3E687CA5BFB386524F923BAC2F986CC3C66BD24F > (Debugger::UI::CommandLine):721 (/media/theo/A224A15B24A13369/ > Users/Public/work/lector/example/lib/.precomp/15864B3E1C12ED > F795F35FA29E098427159D2514.1480934859.92858/3E/3E687CA5BF > B386524F923BAC2F986CC3C66BD24F:) > from gen/moar/Metamodel.nqp:3990 (/home/theo/.rakudobrew/moar-n > om/install/share/nqp/lib/Perl6/Metamodel.moarvm:enter) > from SETTING::src/core/Routine.pm:85 (/home/theo/.rakudobrew/moar-n > om/install/share/perl6/runtime/CORE.setting.moarvm:CALL-ME) > from gen/moar/BOOTSTRAP.nqp:2961 (/home/theo/.rakudobrew/moar-n > om/install/share/nqp/lib/Perl6/BOOTSTRAP.moarvm:) > from gen/moar/stage2/NQPHLL.nqp:1667 (/home/theo/.rakudobrew/moar-n > om/install/share/nqp/lib/NQPHLL.moarvm:command_eval) > from src/Perl6/Compiler.nqp:27 (/home/theo/.rakudobrew/moar-n > om/install/share/nqp/lib/Perl6/Compiler.moarvm:command_eval) > from gen/moar/stage2/NQPHLL.nqp:1607 (/home/theo/.rakudobrew/moar-n > om/install/share/nqp/lib/NQPHLL.moarvm:command_line) > from gen/moar/perl6-debug.nqp:508 (/home/theo/.rakudobrew/moar-n > om/install/share/perl6/runtime/perl6-debug.moarvm:MAIN) > from gen/moar/perl6-debug.nqp:439 (/home/theo/.rakudobrew/moar-n > om/install/share/perl6/runtime/perl6-debug.moarvm:) > from :1 (/home/theo/.rakudobrew/moar-n > om/install/share/perl6/runtime/perl6-debug.moarvm:) > from :1 (/home/theo/.rakudobrew/moar-n > om/install/share/perl6/runtime/perl6-debug.moarvm:) > > thanks, > > -- > Theo van den Heuvel > Van den Heuvel HLT Consultancy > -- 4096R/EA75174B Steve Mynott
Re: debugger dies on me
Hi Steve, I have Ubuntu and therefore use rakudobrew. Possibly some windows remnants persist in the deep. I will try to clean up and reinstall. (I thought I did that but evidently not thoroughly enough). thanks, Steve Mynott schreef op 2016-12-05 12:28: I can see references to /home/theo/.rakudobrew which shouldn't exist if you were using Rakudo Star on its own. Looks like you have mixed up two versions. S -- Theo van den Heuvel Van den Heuvel HLT Consultancy
Re: debugger dies on me
If you are using rakudobrew it's not rakudo star (which is built from a source tar ball or supplied as binaries on some platforms). S On 5 December 2016 at 11:34, Theo van den Heuvel wrote: > Hi Steve, > > I have Ubuntu and therefore use rakudobrew. Possibly some windows remnants > persist in the deep. I will try to clean up and reinstall. (I thought I did > that but evidently not thoroughly enough). > > thanks, > > > Steve Mynott schreef op 2016-12-05 12:28: > >> I can see references to /home/theo/.rakudobrew which shouldn't exist >> if you were using Rakudo Star on its own. >> >> Looks like you have mixed up two versions. >> >> S >> > > -- > Theo van den Heuvel > Van den Heuvel HLT Consultancy > -- 4096R/EA75174B Steve Mynott
Re: debugger dies on me
Sadly, removing rakudobrew entirely (as the site suggests), rebuilding it and rebuilding rakudo and panda does not lead to other output. You were right of course in that I was not using rakudo star. Sorry for the confusion. DO you have a suggestion for something I may have forgotten to remove? thanks, Theo Steve Mynott schreef op 2016-12-05 13:11: If you are using rakudobrew it's not rakudo star (which is built from a source tar ball or supplied as binaries on some platforms). S On 5 December 2016 at 11:34, Theo van den Heuvel wrote: Hi Steve, I have Ubuntu and therefore use rakudobrew. Possibly some windows remnants persist in the deep. I will try to clean up and reinstall. (I thought I did that but evidently not thoroughly enough). thanks, Steve Mynott schreef op 2016-12-05 12:28: I can see references to /home/theo/.rakudobrew which shouldn't exist if you were using Rakudo Star on its own. Looks like you have mixed up two versions. S -- Theo van den Heuvel Van den Heuvel HLT Consultancy -- 4096R/EA75174B Steve Mynott
Re: debugger dies on me
Hi, Have you removed both ~/.rakudobrew and ~/.perl6? On Mon, Dec 5, 2016 at 3:20 PM, Theo van den Heuvel wrote: > Sadly, removing rakudobrew entirely (as the site suggests), rebuilding it > and rebuilding rakudo and panda does not lead to other output. > You were right of course in that I was not using rakudo star. Sorry for > the confusion. > DO you have a suggestion for something I may have forgotten to remove? > > thanks, > Theo > > Steve Mynott schreef op 2016-12-05 13:11: > > If you are using rakudobrew it's not rakudo star (which is built from >> a source tar ball or supplied as binaries on some platforms). >> >> S >> >> On 5 December 2016 at 11:34, Theo van den Heuvel >> wrote: >> >> Hi Steve, >>> >>> I have Ubuntu and therefore use rakudobrew. Possibly some windows >>> remnants persist in the deep. I will try to clean up and reinstall. >>> (I thought I did that but evidently not thoroughly enough). >>> >>> thanks, >>> >>> Steve Mynott schreef op 2016-12-05 12:28: >>> >>> I can see references to /home/theo/.rakudobrew which shouldn't exist if you were using Rakudo Star on its own. Looks like you have mixed up two versions. S >>> >>> -- >>> Theo van den Heuvel >>> Van den Heuvel HLT Consultancy >>> >> >> -- >> 4096R/EA75174B Steve Mynott >> > > -- Fernando Santagata
[perl #130271] [BUG] "Cannot unbox a type object (Any) to a str." with $^var and [⊎]
# New Ticket Created by Zoffix Znet # Please include the string: [perl #130271] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=130271 > This code crashes with "Cannot unbox a type object (Any) to a str". The problem goes away, if I change $^stuff to $_ or to $^stuff.List or to |$^stuff my $materials = bag flat 'wood' xx 300, 'glass' xx 100, 'brick' xx 3000; my @wanted = bag(flat 'wood' xx 200, 'glass' xx 50, 'brick' xx 3000) but "house", bag(flat 'wood' xx 100, 'glass' xx 50) but "shed", bag( 'wood' xx 50) but "dog-house"; say 'I can build...'; .put for @wanted.combinations.grep: { $materials ≽ [⊎] $^stuff };
[perl #130253] [NYI] Coercion type in variable declarations
# New Ticket Created by Michael Schaap # Please include the string: [perl #130253] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=130253 > Coercion type works quite nicely in signatures, e.g. sub foo(Int(Cool) $f) { say $f.WHAT; } foo "42";# (Int) but it doesn't work yet in variable declarations, e.g. my Int(Cool) $x; $x = "42"; # Coercion Int(Cool) is insufficiently type-like to qualify a variable Using Rakudo Star 2016.11: This is Rakudo version 2016.11 built on MoarVM version 2016.11 implementing Perl 6.c.
[perl #130257] [BUG] state variable not initialized in some multi subs
# New Ticket Created by Michael Schaap # Please include the string: [perl #130257] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=130257 > In this example, the state variable appears not to be initialized: multi sub foo(Int $x where 1..10) { state $bar = 42; say $bar; } foo(3); # Output: (Any) When you remove the "where 1..10" clause, it works fine. Or alternatively, remove the "multi" and it works fine as well. Using Rakudo Star 2016.11: This is Rakudo version 2016.11 built on MoarVM version 2016.11 implementing Perl 6.c.
[perl #130267] [BUG] NativeCall: CArray[uint8] may contain negative numbers
# New Ticket Created by Michael Schaap # Please include the string: [perl #130267] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=130267 > use NativeCall; my CArray[uint8] $a .= new(200 xx 16); say $a[0];# expected output: 200, actual output: -56 Using Rakudo Star 2016.11: This is Rakudo version 2016.11 built on MoarVM version 2016.11 implementing Perl 6.c.
[perl #130266] [BUG] t/spec/S32-io/IO-Socket-Async.t generates errors under ASAN/Valgrind
# New Ticket Created by Jan-Olof Hendig # Please include the string: [perl #130266] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=130266 > While running the spectests through ASAN nwc10++ found an invalid read error in t/spec/S32-io/IO-Socket-Async.t. Have included both ASAN and valgrind output. Note that the valgrind output is from a 32 bit system while (I guess) nwc10's output is from a 64 bit system. # ASAN output $ ./perl6-m -Ilib t/spec/S32-io/IO-Socket-Async.t 1..13 ok 1 - Async listen on bogus hostname ok 2 - Async connect to unavailable server breaks promise ok 3 - Async connect to available server keeps promise ok 4 - Echo serverok 5 - Coped with grapheme split across packets ok 6 - Coped with UTF-8 bytes split across packets ok 7 - Bad UTF-8 causes quit on Supply (but program survives) ok 8 - Discard server ok 9 - bytes-supply ok 10 - Server socket configured with latin-1 handles it ok 11 - Can set encoding on incoming Supply separately ok 12 - Latin-1 client socket correctly encodes = ==9389==ERROR: AddressSanitizer: heap-use-after-free on address 0x61100022d720 at pc 0x7f9167a547a1 bp 0x7f915d6857d0 sp 0x7f915d6857c8 WRITE of size 8 at 0x61100022d720 thread T3 #0 0x7f9167a547a0 in uv_timer_init 3rdparty/libuv/src/unix/timer.c:55 #1 0x7f916781c65e in setup src/io/timers.c:24 #2 0x7f9167804daf in setup_work src/io/eventloop.c:20 #3 0x7f9167804fff in async_handler src/io/eventloop.c:41 #4 0x7f9167a222f6 in uv__async_event 3rdparty/libuv/src/unix/async.c:98 #5 0x7f9167a22699 in uv__async_io 3rdparty/libuv/src/unix/async.c:138 #6 0x7f9167a149b1 in uv__io_poll 3rdparty/libuv/src/unix/linux-core.c:345 #7 0x7f9167a2433a in uv_run 3rdparty/libuv/src/unix/core.c:351 #8 0x7f9167805169 in enter_loop src/io/eventloop.c:60 #1 0x7f916781f0c1 in MVM_malloc src/core/alloc.h:2 #2 0x7f9167825731 in listen_setup src/io/asyncsocket.c:719 #3 0x7f9167804daf in setup_work src/io/eventloop.c:20 #4 0x7f9167804fff in async_handler src/io/eventloop.c:41 #5 0x7f9167a222f6 in uv__async_event 3rdparty/libuv/src/unix/async.c:98 #6 0x7f9167a22699 in uv__async_io 3rdparty/libuv/src/unix/async.c:138 #7 0x7f9167a149b1 in uv__io_poll 3rdparty/libuv/src/unix/linux-core.c:345 #8 0x7f9167a2433a in uv_run 3rdparty/libuv/src/unix/core.c:351 #9 0x7f9167805169 in enter_loop src/io/eventloop.c:60 #10 0x7f9167855b86 in invoke_handler src/6model/reprs/MVMCFunction.c:9 #11 0x7f91677a1792 in thread_initial_invoke src/core/threads.c:56 #12 0x7f91676f08e9 in MVM_interp_run src/core/interp.c:61 #13 0x7f91677a1962 in start_thread src/core/threads.c:77 #14 0x7f9167a50cc9 in uv__thread_start 3rdparty/libuv/src/unix/thread.c:49 #15 0x7f9166ae2aa0 in start_thread (/lib64/libpthread.so.0+0x7aa0) Thread T3 created by T0 here: #0 0x7f916830d6ea in __interceptor_pthread_create ../../.././libsanitizer/asan/asan_interceptors.cc:183 #1 0x7f9167a50dce in uv_thread_create 3rdparty/libuv/src/unix/thread.c:66 #2 0x7f91677a1d13 in MVM_thread_run src/core/threads.c:129 #3 0x7f916780559f in get_or_vivify_loop src/io/eventloop.c:97 #4 0x7f916780571e in MVM_io_eventloop_queue_work src/io/eventloop.c:116 #5 0x7f9167824d02 in MVM_io_socket_connect_async src/io/asyncsocket.c:650 #6 0x7f9167751c7c in MVM_interp_run src/core/interp.c:4150 #7 0x7f91679e5390 in MVM_vm_run_file src/moar.c:309 #8 0x401a4f in main src/main.c:192 #9 0x7f9166f1ed1c in __libc_start_main (/lib64/libc.so.6+0x1ed1c) SUMMARY: AddressSanitizer: heap-use-after-free 3rdparty/libuv/src/unix/timer.c:55 uv_timer_init Shadow bytes around the buggy address: 0x0c228003da90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c228003daa0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c228003dab0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c228003dac0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c228003dad0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x0c228003dae0: fd fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd 0x0c228003daf0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fa 0x0c228003db00: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 0x0c228003db10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c228003db20: 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa fa 0x0c228003db30: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Heap right redzone: fb Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack partial redzone: f4 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6
[perl #130271] [BUG] "Cannot unbox a type object (Any) to a str." with $^var and [⊎]
On Mon, 05 Dec 2016 12:14:05 -0800, c...@zoffix.com wrote: > This code crashes with "Cannot unbox a type object (Any) to a str". > > The problem goes away, if I change $^stuff to $_ or to $^stuff.List or > to |$^stuff > > > my $materials = bag flat 'wood' xx 300, 'glass' xx 100, 'brick' xx > 3000; > > my @wanted = > bag(flat 'wood' xx 200, 'glass' xx 50, 'brick' xx 3000) but > "house", > bag(flat 'wood' xx 100, 'glass' xx 50) but > "shed", > bag( 'wood' xx 50) but "dog- > house"; > > say 'I can build...'; > .put for @wanted.combinations.grep: { $materials ≽ [⊎] $^stuff }; Golfed a bit more: [bag() but "house"].combinations.grep: { [⊎] $^stuff-we-want } Any more thing I remove and the bug disappears.
Need some help to understand how modify an AST.
Hi, I don't understand why the 2 following Perl6 programs give a different result when running. If someone could give me an explanation, it will help me a lot. Many thanks. (Note the 2 programs run on Linux and the Linux environment variable $toto is set to "totoenv". ( export toto=totenv ) Program1 : cat test051.pl6 #!/opt/rakudo-star-2016.10/bin/perl6 use v6; grammar TEST { rule TOP { :i \s*} token varenv {'$' } token mot { <[a..z A..Z 0..9 =\-_!~'():@&+$,\']>+ } } class ActionsTest { method TOP ($/) { $/.make( ~%*ENV{$}); } } my $actions = ActionsTest.new; my $script = "\$toto" ; my $scr = TEST.parse($script,:$actions); say $scr; say $scr.made; ===> ./test051.pl6 ?$toto? varenv => ?$toto? mot => ?toto? totoenv This programs runs fine and displayed the value for the toto environment variable. Program2: cat test052.pl6 grammar TEST { rule TOP { :i \s*} token varenv {'$' } token mot { <[a..z A..Z 0..9 =\-_!~'():@&+$,\']>+ } } class ActionsTest { method varenv ($/) { $/.make( %*ENV{$}); } method TOP ($/) { $/.make( ~$/); } } my $actions = ActionsTest.new; my $script = "\$toto" ; my $scr = TEST.parse($script,:$actions); say $scr; say $scr.made; ===> Use of Nil in string context in method varenv at ./test052.pl6 line 14 ?$toto? varenv => ?$toto? mot => ?toto? $toto This program displays an error message and doesn't find the value of toto environment variable. The only difference between the 2 programs is instruction "make( %*ENV{$}" is part of the TOP method in the program 1 and part of the varenv method in program 2. I'm certainly missing something but I don't understand why program 2 doesn't work. I'm very interested to get explanations for that. It will help me to understand how to modify and AST using Perl6. Thanks a lot for your help. Best regards, Jean-Pierre
Re: Need some help to understand how modify an AST.
Hi, On 06.12.2016 00:49, CARAYOL Jean-Pierre wrote: > Hi, > > > > I don't understand why the 2 following Perl6 programs give a different > result when running. > > If someone could give me an explanation, it will help me a lot. Many thanks. > > > > /(Note the 2 programs run on Linux and the Linux environment variable > $toto is set to "totoenv". ( export toto=totenv )/ > > > _Program1 :_ > > /cattest051.pl6/_ > _ > > #!/opt/rakudo-star-2016.10/bin/perl6 > use v6; > > grammar TEST { > rule TOP { :i \s*} > token varenv {'$' } > token mot { <[a..z A..Z 0..9 =\-_!~'():@&+$,\']>+ } > } > > class ActionsTest { > method TOP ($/) { $/.make( ~%*ENV{$}); } > } > > my $actions = ActionsTest.new; > my $script = "\$toto" ; > my $scr = TEST.parse($script,:$actions); > say $scr; > say $scr.made; > ===>./test051.pl6 > 「$toto」 > varenv => 「$toto」 > mot => 「toto」 > *totoenv* > > This programs runs fine and displayed the value for the toto environment > variable. > > > > _Program2:_ > > __cat test052.pl6 > > grammar TEST { > rule TOP { :i \s*} > token varenv {'$' } > token mot { <[a..z A..Z 0..9 =\-_!~'():@&+$,\']>+ } > } > > class ActionsTest { > method varenv ($/) { $/.make( %*ENV{$}); } > method TOP ($/) { $/.make( ~$/); } $/.make stores the result in $/.made, so the second line should be method TOP($/) { $/.make($.made) } HTH, Moritz > } > > my $actions = ActionsTest.new; > my $script = "\$toto" ; > my $scr = TEST.parse($script,:$actions); > say $scr; > say $scr.made; > > ===> > Use of Nil in string context > in method varenv at ./test052.pl6 line 14 > 「$toto」 > varenv => 「$toto」 > mot => 「toto」 > $toto > > This program displays an error message and doesn't find the value of > toto environment variable. > > > The only difference between the 2 programs is instruction "make( > %*ENV{$}" is part of the TOP method in the program 1 and > part of the varenv method in program 2. > > I'm certainly missing something but I don't understand why program 2 > doesn't work. I'm very interested to get explanations for that. It will > help me to understand how to modify and AST using Perl6. > > > Thanks a lot for your help. > > Best regards, > > Jean-Pierre > > -- Moritz Lenz https://deploybook.com/ -- https://perlgeek.de/ -- https://perl6.org/