ess;
$Log::Progress::VERSION = '0.13';
use Moo 2;
use Carp;
use IO::Handle; # for 'autoflush'
use JSON;
# ABSTRACT: Conveniently write progress messages to logger or file handle
has to => (
my ($self, $data)= @_;
ref $data eq 'HASH' or croak "data must be a hashref";
$self->_writer->(JSON->new->ascii->encode($data));
}
sub substep {
my ($self, $step_id, $step_contribution, $title)=
ress-associated data, use this method.
The data must be a hashref. It gets encoded as pure-ascii JSON.
=head2 substep
$progress_obj= $progress->substep( $id, $contribution, $title );
Create a na
package Log::Progress::Parser;
$Log::Progress::Parser::VERSION = '0.13';
use Moo 2;
use JSON;
# ABSTRACT: Parse progress data from a file
has input => ( is => 'rw' );
has input_pos => ( is => '
tle;
$state->{contribution}= $contribution+0;
}
elsif ($remainder =~ /^\{/) {
my $data= JSON->new->decode($remainder);
$state->{data}= !defined $self->on_data? $data
: $self->on_data-
#
step => { $step_id => \%step_state, ... },
data => \%data, # most recent JSON data payload, decoded
}
Substeps may additionally have the keys:
idx => $order_o