use SL::DB::Manager::BackgroundJob;
use SL::System::Process;
+use SL::YAML;
__PACKAGE__->meta->initialize;
sub data_as_hash {
my $self = shift;
+
+ $self->data(SL::YAML::Dump($_[0])) if @_;
+
return {} if !$self->data;
return $self->data if ref($self->{data}) eq 'HASH';
- return YAML::Load($self->{data}) if !ref($self->{data});
+ return SL::YAML::Load($self->{data}) if !ref($self->{data});
return {};
}
sub set_data {
my ($self, %data) = @_;
- my $data = YAML::Load($self->data);
- $data->{$_} = $data{$_} for keys %data;
- $self->data(YAML::Dump($data));
+ $self->data(SL::YAML::Dump({
+ %{ $self->data_as_hash },
+ %data,
+ }));
$self;
}