App-GitHooks

 view release on metacpan or  search on metacpan

lib/App/GitHooks/Hook.pm  view on Meta::CPAN

package App::GitHooks::Hook;

use strict;
use warnings;

# External dependencies.
use Carp;
use Try::Tiny;

# Internal dependencies.
use App::GitHooks::Constants qw( :HOOK_EXIT_CODES :PLUGIN_RETURN_CODES );


=head1 NAME

App::GitHooks::Hook - Base class for all git hook handlers.


=head1 VERSION

Version 1.9.0

=cut

our $VERSION = '1.9.0';


=head1 METHODS

=head2 run()

Run the hook handler and return an exit status to pass to git.

	my $exit_status = App::GitHooks::Hook->run(
		app => $app,
	);

Arguments:

=over 4

=item * app I<(mandatory)>

An L<App::GitHooks> object.

=item * stdin I<(optional)>

An arrayref of lines retrieved from SDTIN.

See for example the C<pre-push> hook for uses of this argument.

=back

=cut

sub run
{
	my ( $class, %args ) = @_;
	my $app = $args{'app'};
	my $stdin = $args{'stdin'};

	# Find all the plugins that are applicable for this hook.
	my $plugins = $app->get_hook_plugins( $app->get_hook_name() );

	# Run all the plugins.
	my $has_errors = 0;
	foreach my $plugin ( @$plugins )
	{



( run in 1.820 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )