Víctor Moral > Iterator-BreakOn-0.4 > Iterator::BreakOn::Base

Download:
Iterator-BreakOn-0.4.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.3   Source  

NAME ^

Iterator::BreakOn::Base - Base class for iterator with flow breaks

SYNOPSIS ^

    package MyIterator;
    use qw(Iterator::BreakOn::Base);

    1;

DESCRIPTION ^

This module is a base class for build iterators with flow breaks. Provides methods for create and proccess the iterators.

SUBROUTINES/METHODS ^

new( )

This method create a new package object. The parameters are:

The following atributes can be a list of fields followed for an optional code reference. The order of the fields is significant.

These attributes must contain a code reference.

init( )

This method initialize the object attributes.

reset( )

This method reset the event queue of the object.

run( )

    $iter->run();

next( )

    while (my $item_ref = $iter->next()) {
        # do something ...
    }

This method returns the next item in the data source after process the other events in the queue.

next_event( )

    while (my $event = $iter->next_event()) {
        if ($event->name() eq 'on_last') {
            # end of data reached
            ...
        }
        ...
    }

This method return the next event in the data source. For each item readed the event name is 'on_every'.

The event is an object with the following attributes:

name

The event name can be on_first, on_last, on_every, before_XXXX or after_XXXX.

field

This is the field name if the event is before or after.

value

Field value when the event was raised.

item( )

Returns a reference to the current item in the iterator.

current_values( )

Calls to the optional getall method on the current item in the iterator, and returns a hash with fields and values.

private( )

Returns a reference to the private data save in the object.

DIAGNOSTICS ^

A list of every error and warning message that the module can generate.

CONFIGURATION AND ENVIRONMENT ^

A full explanation of any configuration system(s) used by the module, including the names and locations of any configuration files, and the meaning of any environment variables or properties that can be set. These descriptions must also include details of any configuration language used.

DEPENDENCIES ^

A list of all the other modules that this module relies upon, including any restrictions on versions, and an indication of whether these required modules are part of the standard Perl distribution, part of the module's distribution, or must be installed separately.

INCOMPATIBILITIES ^

A list of any modules that this module cannot be used in conjunction with. This may be due to name conflicts in the interface, or competition for system or program resources, or due to internal limitations of Perl (for example, many modules that use source code filters are mutually incompatible).

BUGS AND LIMITATIONS ^

There are no known bugs in this module. Please report problems to the author. Patches are welcome.

AUTHOR ^

Víctor Moral <victor@taquiones.net>

LICENSE AND COPYRIGHT ^

Copyright (c) 2007 - Victor Moral

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

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

syntax highlighting: