package MEvent::Subroutine;
use strict;

use vars qw(@ISA);
use MEvent;
@ISA = qw(MEvent);

use MCoreTools;

sub new {
  my ($class, %param) = @_;
  
  my $self = $class->SUPER::new(%param);
  
  $self->{'sub'} = $param{'sub'} or croak "No sub specified";
  $self->{arguments} = $param{arguments} || [];
  
  $self;
}

sub run {
  my ($self) = @_;
  
  $self->SUPER::run();
  
  # it's not our job to catch exceptions...
  $self->{'sub'}->(@{$self->{arguments}}); # should be void context
  1;
}
sub no_store {1}

sub description {'subroutine'}
