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

List::Analyse::Sequence - Analyse a list for sequences.

VERSION

Version 0.01

DESCRIPTION

Given a list, analyse it for sequences. Sequences are defined by their Analyser classes, which are plugins to this module and are found under List::Analyse::Sequence::Analyser.

SYNOPSIS

    use List::Analyse::Sequence;

    my $analyser = List::Analyse::Sequence->new();

    $analyser->use_these_analysers( $analyser->analysers );

    $analyser->analyse( @list );
    my @($valid_sequences, $invalid_sequences) = $analyser->result;
    
    # ... OR ... #

    while ( my $list_item = $some_iterator->next ) {
        $analyser->add( $list_item );
    }

    my ($valid_sequences, $invalid_sequences) = $analyser->result;

CONSTRUCTOR

new

Creates a new sequence analyser.

METHODS

analysers

Returns a list of available analysers. You can create an analyser by putting a module in somewhere that List::Analyse::Sequence::Analyser::* will find.

See List::Analyse::Sequence::Analyser for info.

use_these_analysers

Pick a bunch of analysers from $obj->analysers and provide them here. These will be used to analyse the list.

If you're feeling cocky then you should know that the list passed in is just a bunch of class names whose constructors are expected to be new().

analyse

Pass in a list of things to analyse. Each of your analysers will look at the list and decide whether or not the list adheres to its sequence definition.

add

An alternative to passing a list to analyse() is to pass a scalar to add. This will run each analyser on the added element.

This is especially useful for when you are using an iterator, or some form of lasagne code, for example.

result

Get the result of the analysis, as two arrayrefs. The first will contain those analysers whose sequence definitions were fulfilled by all items: the second will contain those that were discarded.

AUTHOR

Alastair Douglas, <altreus at perl.org>

BUGS

Please report any bugs or feature requests to bug-list-analyse-sequence at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=List-Analyse-Sequence. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc List::Analyse::Sequence

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2009 Alastair Douglas, all rights reserved.

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