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

coderef behaves differently from Keyword::Simple #2

Closed
iynehz opened this issue Dec 8, 2018 · 3 comments
Closed

coderef behaves differently from Keyword::Simple #2

iynehz opened this issue Dec 8, 2018 · 3 comments

Comments

@iynehz
Copy link
Contributor

iynehz commented Dec 8, 2018

It's good to see this library as a fork of Keyword::Simple as I am interested in using keyword in an expression rather than just at the head of a statement. But I see this library would always prepend to rest of the souce, while Keyword::Simple actually allows one to change rest of the source. For example, below demo code of Keyword::Simple would just print "foo", but how can you do the same thing with Keyword::Pluggable?

use 5.014;
use warnings;

package Foo {
    use Keyword::Simple;

    sub import {
        Keyword::Simple::define 'foo', sub {
            my ($ref) = @_;
            $$ref = q{say "foo"};
        };
    }
};

BEGIN { Foo->import; }

foo(1);
say "bar";
@dk
Copy link
Owner

dk commented Dec 8, 2018

Hi

Thanks for the feedback.
That functionality indeed first was inherited from Keyword::Simple, until in the process of simplification it was somehow phased away.
But now I'm committing it back because it wasn't intended to get rid of it.
I think the latest commit changed it, please test

/dk

@iynehz
Copy link
Contributor Author

iynehz commented Dec 9, 2018

@dk Thanks for the quick response. But which commit? As I see it last commit as 16 days ago.

@dk
Copy link
Owner

dk commented Dec 9, 2018

ah, forgot git push. Pls try again

@dk dk closed this as completed Jun 24, 2024
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

2 participants