tags:

views:

167

answers:

1
+3  A: 

It sure looks like you've hit the problem that Rocco is describing. Basically, your closure (the sub {...}) has access to $heap because $heap is in scope when you create the closure. On the other hand, when you use the &kill_top1 function reference it appears you're not getting any parameters passed in, which means @_[HEAP] is undefined.

Using the closure seems to work, but if you wanted to "fake" it, you could replace it with:

kill_top1 => sub { 
    @args[KERNEL,SESSION,HEAP] = ($kernel,$session,$heap);
    kill_top1(@args);
}

This would be my preference, just to keep the interface to, and event handling of, kill_top1 the same as all the others.

Andrew Barnett