# New Ticket Created by Justin DeVuyst # Please include the string: [perl #131714] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=131714 >
I golfed it as much as I could. See Below. jdv@new-host-2 t]$ cat html_decode.pl use strict; use warnings; use HTML::Entities; use JSON::XS; my $in = decode_json(join('', <STDIN>)); decode_entities($in->{html}) for 1..($in->{iterations} // 1); print JSON::XS->new->utf8->canonical->pretty->encode( { html => $in->{html} }); [jdv@new-host-2 t]$ [jdv@new-host-2 t]$ cat 01-basic.t use v6; use XML; class Agent::RedditAgent { method html-decode (:$html is copy, :$iterations = 1) { my $p = run 'perl', './html_decode.pl', :in, :out; $p.in.print(to-json({ :$html, :$iterations })); $p.in.close; from-json($p.out.slurp-rest)<html>; } method run { loop { sleep 1; my $content = run( 'curl', '-s', '-A', '', <https://www.reddit.com/r/perl6/.rss>, :out ).out.slurp(:close); my %entries = map { self.html-decode(html => '', :2iterations); |(); }, from-xml($content).lookfor(:TAG<entry>); } } } await start { Agent::RedditAgent.new.run } [jdv@new-host-2 t]$ [jdv@new-host-2 t]$ perl6-gdb-m 01-basic.t ================================================================================================ This is Rakudo Perl 6 running in the GNU debugger, which often allows the user to generate useful back- traces to debug or report issues in Rakudo, the MoarVM backend or the currently running code. This Rakudo version is 2017.06.170.gb.0.c.8.e.18 built on MoarVM version 2017.06.37.g.4.e.29.e.4.c, running on fedora (25.Workstation.Edition) / linux (4.11.5.200.fc.25.x.86._.64) Type `bt full` to generate a backtrace if applicable, type `q` to quit or `help` for help. ------------------------------------------------------------------------------------------------ Reading symbols from /home/jdv/rakudo/install/bin/moar...done. Starting program: /home/jdv/rakudo/install/bin/moar --execname=/home/jdv/rakudo/install/bin/perl6-gdb-m --libpath=/home/jdv/rakudo/install/share/nqp/lib --libpath=/home/jdv/rakudo/install/share/perl6/lib --libpath=/home/jdv/rakudo/install/share/perl6/runtime /home/jdv/rakudo/install/share/perl6/runtime/perl6.moarvm 01-basic.t [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". [New Thread 0x7ffff453b700 (LWP 28134)] [New Thread 0x7ffff3939700 (LWP 28136)] [New Thread 0x7ffff2d37700 (LWP 28137)] Detaching after fork from child process 28138. [New Thread 0x7ffff2135700 (LWP 28139)] [New Thread 0x7ffff1533700 (LWP 28142)] [New Thread 0x7fffdb3fc700 (LWP 28148)] Detaching after fork from child process 28149. [New Thread 0x7fffda7fa700 (LWP 28150)] [New Thread 0x7fffd9bf8700 (LWP 28151)] [New Thread 0x7fffd8ff6700 (LWP 28152)] [New Thread 0x7fffcbfff700 (LWP 28153)] [New Thread 0x7fffca7fb700 (LWP 28155)] [New Thread 0x7fffcaffc700 (LWP 28154)] [New Thread 0x7fffc9bf9700 (LWP 28156)] [New Thread 0x7fffc8bf6700 (LWP 28157)] [New Thread 0x7fffb3fff700 (LWP 28158)] Detaching after fork from child process 28159. [New Thread 0x7fffb33fd700 (LWP 28160)] [New Thread 0x7fffb27fb700 (LWP 28161)] Detaching after fork from child process 28162. ... Detaching after fork from child process 28490. Thread 2 "moar" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7ffff453b700 (LWP 28134)] 0x00007ffff782e2b7 in gc_mark (tc=0x38fd470, st=<optimized out>, data=<optimized out>, worklist=0x7fffeea2ecc0) at src/6model/reprs/MVMCallCapture.c:54 54 if (flag_map[flag] & MVM_CALLSITE_ARG_NAMED) { Missing separate debuginfos, use: dnf debuginfo-install glibc-2.24-6.fc25.x86_64 (gdb) bt #0 0x00007ffff782e2b7 in gc_mark (tc=0x38fd470, st=<optimized out>, data=<optimized out>, worklist=0x7fffeea2ecc0) at src/6model/reprs/MVMCallCapture.c:54 #1 0x00007ffff7808bd0 in process_worklist (tc=tc@entry=0x38fd470, worklist=worklist@entry=0x7fffeea2ecc0, wtp=wtp@entry=0x7ffff453a990, gen=gen@entry=0 '\000') at src/gc/collect.c:313 #2 0x00007ffff780926d in MVM_gc_collect (tc=0x38fd470, what_to_do=<optimized out>, gen=gen@entry=0 '\000') at src/gc/collect.c:129 #3 0x00007ffff7805085 in run_gc (tc=tc@entry=0x38fd470, what_to_do=what_to_do@entry=0 '\000') at src/gc/orchestrate.c:357 #4 0x00007ffff7805a31 in MVM_gc_enter_from_allocator (tc=tc@entry=0x38fd470) at src/gc/orchestrate.c:470 #5 0x00007ffff7805c28 in MVM_gc_allocate_nursery (tc=0x38fd470, size=56) at src/gc/allocation.c:32 #6 0x00007ffff7805e64 in MVM_gc_allocate_object (tc=0x38fd470, st=<optimized out>) at src/gc/allocation.c:86 #7 0x00007ffff7818a03 in MVM_repr_alloc_init (tc=0x38fd470, type=<optimized out>) at src/6model/reprconv.c:13 #8 0x00007ffff5d8437a in p6scalarfromdesc () from /home/jdv/rakudo/install/share/perl6/runtime/dynext/libperl6_ops_moar.so #9 0x00007ffff5c06c89 in ?? () #10 0x0000000000000008 in ?? () #11 0x00007ffff78c34c8 in ?? () from //home/jdv/rakudo/nqp/MoarVM/install/lib/libmoar.so #12 0x00007fffece09d10 in ?? () #13 0x00007ffff77ec942 in MVM_frame_invoke (tc=<optimized out>, static_frame=<optimized out>, callsite=<optimized out>, args=<optimized out>, outer=<optimized out>, code_ref=<optimized out>, spesh_cand=<optimized out>) at src/core/frame.c:571 #14 0x0000000000e5e0f8 in ?? () #15 0x00007ffff58c6c46 in ?? () #16 0x00007ffff786eb19 in MVM_jit_enter_code (tc=<optimized out>, cu=<optimized out>, code=<optimized out>) at src/jit/compile.c:139 #17 0x00007ffff77d7733 in MVM_interp_run (tc=tc@entry=0x38fd470, initial_invoke=0x7fffee90fbb0, invoke_data=0x7fffeea53a68, invoke_data@entry=0x38fc700) at src/core/interp.c:5499 #18 0x00007ffff77f40fe in start_thread (data=0x38fc700) at src/core/threads.c:85 #19 0x00007ffff78bc847 in uv.thread_start () from //home/jdv/rakudo/nqp/MoarVM/install/lib/libmoar.so #20 0x00007ffff6d7973a in start_thread () from /lib64/libpthread.so.0 #21 0x00007ffff73a0e7f in clone () from /lib64/libc.so.6 (gdb) jdv@new-host-2 t]$