http://www.perlmonks.org?node_id=588726


in reply to Re^2: Old Code reference wants new life as Object.
in thread Old Code reference wants new life as Object.

In that case, the easiest thing to do is probably:

$dispatch{self_test} = sub { $self->login };

This will create an anonymous code reference that makes a closure on $self, so everything should be in place when the code actually gets called.

Update: Er, which is exactly what ikegami responded with. I guess I should have re-read the original replies before posting.