in reply to Accessing variable in callback running context
Pass a hash or hash reference to the callback; that way it's easy for the callback writer to focus on just those parameters that he wants.
Or depending on context you work in, it might make sense to encapsulate most of the information in an object that you pass to the callback.
Or you can simply pass it as a normal argument, and have the callback writer check scalar @_ to find how many are passed (though that's less convenient than a hash(ref)).
It might (or might not) be also an XY Problem -- if you describe the broader context of your problem, maybe we can find a better solution altogether.
|
|---|