The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Gherkin::Pickles::Compiler - Transform Gherkin to execution plans

SYNOPSIS

use Data::Dumper;
use Gherkin::Parser;
use Gherkin::Pickles::Compiler;


my $parser = Gherkin::Parser->new();
my $envelope = $parser->parse( 'my.feature' );

my $c = 0;
Gherkin::Pickles::Compiler->compile( $envelope,
                                     sub { $c++ },
                                     sub { print Dumper($_[0]) . "\n" },
);

DESCRIPTION

The pickle compiler translates the Gherkin document representation (AST) as represented by a Cucumber::Messages::GherkinDocument message into a series of test execution plans (pickles).

CLASS METHODS

compile($envelope, $id_generator, [$sink])

Traverses the gherkin document as wrapped by the $envelope message, generating execution plans represented by Cucumber::Messages::Pickle messages.

If a $sink is provided, this function is called for each Pickle being generated, with one argument: an envelope messages wrapping a Pickle.

In case no $sink is provided, the pickle messages will be collected and returned (each wrapped in an envelope) from the function.

The $id_generator is a generator function responsible for returning unique string values, used to identify nodes in the returned Pickles.

SEE ALSO

LICENSE

See Gherkin.