in reply to Re: Hiding, but maintaining variables in user-defined code
in thread Hiding, but maintaining variables in user-defined code
That is, if you call a function via the amperstand approach, with no arguements, the current value of @_ is passed along to that function. So in my case:
the value of @_ that helper() sees would be whatever execute() left @_ as, so here, I could easily fill up @_ with $self and any other variables that I wish. However... some of the functions of similar nature to helper that I have planned would also require user-added arguments, and thus this completely breaks down, since specifying any arguements does not pass @_ further.$test->execute( sub { print "in the local coderef\n"; &MyPackage::helper; } );
I think what I will end up doing is forcing the user to specify "$self->helper", and then remove any variables that would be passed to the help functions from access by the user.
</CODE>
|
|---|