From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

### The switching system to parse a message
sub new {
my ($class, $newprinter, $newcompiler) = @_;
$self = { printer => $newprinter, compiler => $newcompiler, };
bless $self, $class;
}
sub runOnce {
my $self = shift;
### FIXME
}
sub switch {
my ($self, $mesg) = @_;
return $self->parseMessage($mesg);
}
sub parseMessage {
my ($self, $mesg) = @_;
given($mesg->getTypeString) {
when ("print") {
$tobeprinted = $mesg->getCarry->getData;
$self->{printer}->println($tobeprinted)
}
when ("load") {
### FIXME adds load component with $self->{compiler}
}
when ("select") {
### FIXME adds select component with $self->{compiler}
}
}
}
1;