Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please document that some_method => \&some_sub works #18

Open
bpj opened this issue Oct 1, 2016 · 1 comment
Open

Please document that some_method => \&some_sub works #18

bpj opened this issue Oct 1, 2016 · 1 comment

Comments

@bpj
Copy link

bpj commented Oct 1, 2016

Please document that it is possible to assign a reference to a named subroutine to a key to mock a method:

my $obj = qobj(
    some_method => \&some_sub,
);

I had to dig up the implementation of AUTOLOAD to verify that this was indeed the case.

Use case: trying out a component when another component/embedded object isn't written yet, except for that one subroutine.

And even more importantly perhaps, document that in order to have a method return a coderef you have to say:

method_returning_coderef => qmeth { \&some_sub },
@bpj
Copy link
Author

bpj commented Oct 1, 2016

On closer inspection it doesn't work! X-(

You have to do

some_method => qmeth { goto &some_sub },

Which however ought to be documented though! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant