Event.pm: add a new_event helper to parse and construct an Event
An Event will be part of many Tasks
This commit is contained in:
committed by
Your Name
parent
64a3e75c10
commit
4e86e55008
@ -1,14 +1,9 @@
|
||||
package Hydra::Event;
|
||||
|
||||
|
||||
use strict;
|
||||
use Hydra::Event::BuildFinished;
|
||||
use Hydra::Event::BuildStarted;
|
||||
use Hydra::Event::StepFinished;
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(
|
||||
parse_payload
|
||||
);
|
||||
|
||||
my %channels_to_events = (
|
||||
build_started => \&Hydra::Event::BuildStarted::parse,
|
||||
@ -28,3 +23,14 @@ sub parse_payload :prototype($$) {
|
||||
|
||||
return $parser->(@payload);
|
||||
}
|
||||
|
||||
|
||||
sub new_event {
|
||||
my ($self, $channel_name, $payload) = @_;
|
||||
|
||||
return bless {
|
||||
"channel_name" => $channel_name,
|
||||
"payload" => $payload,
|
||||
"event" => parse_payload($channel_name, $payload),
|
||||
}, $self;
|
||||
}
|
||||
|
Reference in New Issue
Block a user