Report
=title class Zef::Report
=subtitle A configurable implementation of the Reporter interface
Synopsis
use Zef;
use Zef::Report;
use Zef::Distribution::Local;
# Setup with a single installer backend
my $reporter = Zef::Report.new(
backends => [
{ module => "Zef::Service::FileReporter" },
],
);
# Assuming our current directory is a raku distribution...
my $dist-to-report = Zef::Distribution::Local.new($*CWD);
my $candidate = Candidate.new(dist => $dist-to-report);
my $logger = Supplier.new andthen *.Supply.tap: -> $m { say $m.<message> }
# ...report the distribution using the all available backends
my $reported = so $reporter.report($candidate, :$logger);
say $reported ?? 'Reported OK' !! 'Something went wrong...';
Description
A Reporter
class that uses 1 or more other Reporter
instances as backends. It abstracts the logic
to do 'report this distribution with every backend that supports the given distribution'.
Methods
method report
method report(Candidate $candi, Supplier :$logger)
Reports information about the distribution $candi.dist
to a temporary file (the file can be discovered
from the output message emitted).
An optional :$logger
can be supplied to receive events about what is occurring.
Returns True
if the reporting succeeded.