This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env perl6 | |
| use lib ‘data/all-modules/softmoth/p6-Template-Mustache’; | |
| use v6; | |
| #use v6.d.PREVIEW; | |
| use Template::Mustache; | |
| my $html = q:to/EOF/; | |
| <html> | |
| {{> head }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use nqp; | |
| my $html; | |
| my $proc = run "wget", "-o", "/dev/null", "-O", "-", "https://www.fimfiction.net/bookshelf/149291/", :out; | |
| $html = $proc.out.slurp-rest; | |
| say "html is " ~ $html.chars ~ " chars"; | |
| nqp::force_gc; | |
| say "/proc/$*PID/statm".IO.lines[0].split(/\s/)[5] * 4096 / 1024 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use nqp; | |
| { | |
| constant $read-file = "README.md".IO; | |
| $read-file.IO.r; | |
| for ^1000 { | |
| my $p = Proc::Async.new( | «/bin/cat $read-file» ); | |
| my $output = ''; | |
| $p.stdout.tap: -> $s { $output ~= $s; }; | |
| await $p.start; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| multi sub infix:<+>(Unit $x, Unit $y) { | |
| if (not $x.isSameUnit($y)) {die "Units do not match.";} | |
| return Unit.new(magnitude => $x.magnitude + $y.magnitude, units => $x.units); | |
| } | |
| my $a = Units::Unit.new(magnitude => 1.2, units => ("m" => 1)); | |
| my $b = Units::Unit.new(magnitude => 5.0, units => ("m" => 1)); | |
| say $a + $b; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| my class a { | |
| has @.b; | |
| method get-flat { @!b.map(|*.get-flat); } | |
| method p { | |
| say 'A: ', WHAT $.get-flat; | |
| # why doesn't this loop act like D: below? | |
| for self.get-flat() -> $c { | |
| say 'B: ', $c.perl | |
| } | |
| } |
NewerOlder