# New Ticket Created by ab5tract # Please include the string: [perl #124057] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=124057 >
I encountered a consistent segfault while working out a trivial proxy example in hopes of documenting the class. How this might be condensed further is beyond me at the moment. After removing the $!scrambler attribute, the code will no longer segfault, which would defeat the purpose of this rakudobug. Weirdly enough, if I remove $!string, it also stops segfaulting -- even though it is never used. The name of the attribute doesn't seem to matter. This class is modeled off of what I saw in the proxy-related spec tests. The mutator test seems to do something very similar, but I haven't been able to extend it. ## codeword.p6 class Codeword { has Sub $.scrambler is rw; has $!string; has $!encoded-string; submethod BUILD { my sub scrambler { $^s.trans: 'a..mn..z' => 'n..za..m', :ii } $!scrambler = &scrambler; } method codeword returns Str is rw { return Proxy.new( FETCH => method () { $!encoded-string }, STORE => method ($s) { $!encoded-string = $!scrambler($s) } ); } } my $code = Codeword.new; $code.codeword; ## perl6-debug-m output: + proxy-test.p6 (23 - 25) | | my $code = Codeword.new; | $code.codeword; > + proxy-test.p6 (15 - 22) | | method codeword returns Str is rw { | return Proxy.new( | FETCH => method () { $!encoded-string }, | STORE => method ($s) { $!encoded-string = $!scrambler($s) } | ); | } | } > + proxy-test.p6 (16 - 20) | method codeword returns Str is rw { | return Proxy.new( | FETCH => method () { $!encoded-string }, | STORE => method ($s) { $!encoded-string = $!scrambler($s) } | ); > ~/.rakudobrew/bin/perl6-debug-m: line 2: 14368 Segmentation fault: 11 ~/.rakudobrew/bin/../moar-HEAD/install/bin/perl6-debug-m "$@"