It's worth pointing out to anyone stumbling upon this thread that the above example will only restore a self contained anonymous sub and not a closure (ie. storable doesn't attempt to restore the lexical state of the sub { }).