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

implement hook #119

Open
wants to merge 1 commit into
base: master
from

Conversation

1 participant
@skaji
Owner

skaji commented Apr 19, 2018

This PR implements hook into cpm. Hooks are specified in cpanfile.

Here is an example:

requires 'Foo', hook => sub {
  $_->patch('SKAJI/Foo.patch'); # fetch SKAJI/Foo.patch from cpan, and apply it.
  $_->patch('./patches/local.patch'); # relative local patch should be started with './'
  $_->patch('https://example.com/your.patch');
  $_->add_requires('Bar1' => '0.10');
  $_->add_configure_requires('Bar2' => '0.20');
  $_->add_build_requires('Bar3' => '0.30');
  $_->add_test_requires('Bar4' => '0.40');
  $_->delete_requires('Hoge1');
  $_->delete_configure_requires('Hoge2');
  $_->delete_build_requires('Hoge3');
  $_->delete_test_requires('Hoge4');
  $_->configure_args('args1', 'args2'); # perl Makefile.PL args1 args2
  $_->build_args('args1', 'args2'); # make args1 args2
  $_->test_args('args1', 'args2'); # make test args1 args2
  $_->install_args('args1', 'args2'); # make install args1 args2
  $_->env('FOO' => 'A');
  $_->pureperl_only(1);
};

Some practical examples are:

requires 'HTML::Tidy', hook => sub { $_->add_configure_requires('Alien::Tidyp') };

@skaji skaji force-pushed the hook branch from e5a4727 to c95fa76 Apr 20, 2018

@skaji skaji force-pushed the hook branch from c95fa76 to b0f3bbb Apr 20, 2018

@skaji

This comment has been minimized.

Owner

skaji commented Apr 20, 2018

I actually don't know we should call this feature "hook" :)
Then what should I call this feature? "prefs"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment