=head1 NAME KelpX::Hooks - Override any method in your Kelp application =head1 SYNOPSIS # in your Kelp application use KelpX::Hooks; # and then... hook "template" => sub { return "No templates for you!"; }; =head1 DESCRIPTION This module allows you to override methods in your Kelp application class. The provided C method can be compared to Moose's C, and it mimics its interface. The difference is in how and when the replacement of the actual method occurs. The problem here is that Kelp's modules are modifying the symbol table for the module at the runtime, which makes common attempts to change their methods` behavior futile. You can't override them, you can't change them with method modifiers, you can only replace them with different methods. This module fights the symbol table magic with more symbol table magic. It will replace any method with your anonymous subroutine after the application is built and all the modules have been loaded. =head2 EXPORT =head3 hook hook "sub_name" => sub { my ($original_sub, $self, @arguments) = @_; # your code, preferably do this at some point: return $self->$original_sub(@arguments); }; Allows you to provide your own subroutine in place of the one specified. The first argument is the subroutine that's being replaced. It won't be run at all unless you call it explicitly. Please note that Kelp::Less is not supported. =head1 SEE ALSO L, L =head1 AUTHOR Bartosz Jarzyna, Ebrtastic.dev@gmail.comE =head1 COPYRIGHT AND LICENSE Copyright (C) 2020 by Bartosz Jarzyna This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available. =cut