NAME

DBIx::Squirrel::Stop - end a DBIx::Squirrel pipeline early

SYNOPSIS

use DBIx::Squirrel::Stop;

# In a stage of a pipeline
sub ($row) { Stop() if $done; ... }

# Stop, passing on a last value
sub ($row) { $row->{id} == $wanted ? Stop($row) : () }

# The same, without importing Stop
sub ($row) { Ekorn::Pipeline::Stop->throw if $done; ... }

DESCRIPTION

DBIx::Squirrel's pipeline is Ekorn::Pipeline's. This module is DBIx::Squirrel's name for Ekorn::Pipeline::Stop's function, which that module describes in full. It exports Stop by default. That's Ekorn's function, from a list of DBIx::Squirrel's own. The module is here to stay, so code written with it keeps working. It isn't a class: a stop is an Ekorn::Pipeline::Stop.

A stop is the exception that ends a pipeline early and quietly. The rest of the stage that throws it doesn't run. The values already out of the pipeline are kept. The values the stop carries go on through the stages after it, and nothing else is processed.

FUNCTIONS

Stop

Stop();
Stop(@values);

Throws a stop carrying @values. The function is "Stop" in Ekorn::Pipeline::Stop, so the stop is an Ekorn::Pipeline::Stop. To keep it out of your namespace:

use DBIx::Squirrel::Stop ();

To throw one without importing Stop, or to throw a subclass of your own, use "throw" in Ekorn::Pipeline::Stop:

Ekorn::Pipeline::Stop->throw(@values);
My::Stop->throw(@values);    # @ISA = ('Ekorn::Pipeline::Stop')

Catching errors in a stage

A stage that catches errors itself, with eval or try, should throw a stop on again. Check for Ekorn::Pipeline::Stop. Every stop is one, whether thrown with Stop, with throw, or by a canned stage such as take:

sub ($row) {
    try { ... }
    catch ($e) {
        die $e if $e isa 'Ekorn::Pipeline::Stop';
        ...
    }
}

DIAGNOSTICS

Stop used outside a pipeline

A stop was thrown where no pipeline was running to catch it.

SEE ALSO

Ekorn::Pipeline::Stop, DBIx::Squirrel

AUTHOR

Iain Campbell <cpanic@cpan.org>

LICENSE

Copyright (c) 2024-2026 by Iain Campbell.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.