Skip to content

Unable to monkey-patch a subroutine of a plugin to be loaded in Mojolicious framework #2057

Closed Answered by prajwar007
prajwar007 asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for your answer. So I had to just use use Mojo::Base 'Mojolicious::Plugin::SecureCORS'; and then to override/mokeypatch any subroutine of SecureCORS plugin used my $cors_getopt = &Mojolicious::Plugin::SecureCORS::_getopt; *{'Mojolicious::Plugin::SecureCORS::getopt'} = sub { my %opt = &$cors_getopt(@); $opt{'origin'} = get_allowed_origin(); return %opt; };

This way I was able to do it.

Thanks for your help!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@prajwar007
Comment options

Answer selected by prajwar007
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants