Slide 28
Slide 28 text
Basic plugin
Plugin writer:
Writes to gzip via
“run(...).in”, gzip’s
stdin.
method open-output
( Str $path -> Code )
{
with
$path.IO.child( "$path.gz" ).open( :w )
-> $out will end {.close}
{
my $gzip
= run
(
< /bin/gzip ‑9 >, :out( $out ), :in
).in ;
sub { $gzip.print( $^line ) }
}
else { die "Failed open: $path, $!" }
}