Dredd-Hooks

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

[Dredd hooks handler socket interface](https://dredd.readthedocs.org/en/latest/hooks-new-language/)
and ensures that hooks from user defined hook files are run in
the correct order and with the correct information.

Dredd::Hooks::Methods provides functionallity that allow the
user to define the hooks files that get run and their
functionality.

# Creating a hook file

Hookfiles are plain .pl perl files containing some callbacks
that are run for specific events.

The hookfile should have a .pl file extention (required by the
dredd funtion and are provided as an argument to the dredd code:

`dredd apiary.apib http://localhost:5000 --language perl --hookfiles=./hooks/hooks_*.pl`

for each event listed in the Dredd documentation a method is
provided that takes a sub ref that will be run for that event,
This event will receive a transaction (HashRef) or an arrayref of

README.md  view on Meta::CPAN


    beforeAll(sub {
        my ($transactions) = @_;
    });

    beforeEach(sub {
        my ($transaction) = @_;
    });

See the each event below for the which events take which arguments.
If multiple callbacks are defined for the same event then these will
be run individually in the order defined. e.g:

    beforeAll(sub {
        ... # Run First
    });

    beforeAll(sub {
        ... # Run Second
    });

lib/Dredd/Hooks/Methods.pm  view on Meta::CPAN

L<Dredd hooks handler socket interface|https://dredd.readthedocs.org/en/latest/hooks-new-language/>
and ensures that hooks from user defined hook files are run in
the correct order and with the correct information.

Dredd::Hooks::Methods provides functionallity that allow the
user to define the hooks files that get run and their
functionality.

=head1 Creating a hook file

Hookfiles are plain .pl perl files containing some callbacks
that are run for specific events.

The hookfile should have a .pl file extention (required by the
dredd funtion and are provided as an argument to the dredd code:

C<dredd apiary.apib http://localhost:5000 --language perl --hookfiles=./hooks/hooks_*.pl>

for each event listed in the Dredd documentation a method is
provided that takes a sub ref that will be run for that event,
This event will receive a transaction (HashRef) or an arrayref of

lib/Dredd/Hooks/Methods.pm  view on Meta::CPAN


    beforeAll(sub {
        my ($transactions) = @_;
    });

    beforeEach(sub {
        my ($transaction) = @_;
    });

See the each event below for the which events take which arguments.
If multiple callbacks are defined for the same event then these will
be run individually in the order defined. e.g:

    beforeAll(sub {
        ... # Run First
    });

    beforeAll(sub {
        ... # Run Second
    });



( run in 0.337 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )