NAME

DataFlow::Types - Type definitions for DataFlow

VERSION

version 1.121830

SYNOPSIS

When defining a Moose attribute. Example:

has 'direction' => (
    is  => 'ro',
    isa => 'ConversionDirection',
);

DESCRIPTION

This module contains only type definitions. Most of the time there will be no need to work or mess with this code, unless there is a bug in DataFlow and/or you are developing a new feature which requires a new type or an adjustment to an existing one.

SUBTYPES

Processor

A DataFlow::Proc object, with coercions.

Coercions

from Str

Named processors. If it contains the substring '::', DataFlow will try to create an object of that type. If it does not, then DataFlow will attempt to create an object of the type DataFlow::Proc::<STRING>. The string 'Proc' is reserved for creating an object of the type <DataFlow::Proc>.

from ArrayRef

Named processor with parameters. The first element of the array must be a text string, subject to the rules used in the previous item. The rest of the array is passed as-is for the constructor of the object.

from CodeRef

Code reference, a.k.a. a sub. A processor object will be created:

DataFlow::Proc->new( p => CODE )

from DataFlow::Role::Processor

An object that can process something. Objects from both DataFlow and DataFlow::Proc classes will consume that role, so will all its descendants. If the element is blessed and ->does('DataFlow::Role::Processor'), a processor object will be created wrapping it:

DataFlow::Proc->new( p => sub { PROCESSOR->process($_) } )

ProcessorList

An ArrayRef of DataFlow::Role::Processor objects, with at least one element.

Coercions

from ArrayRef

Attempts to make DataFlow::Role::Processor objects out of different things provided in an ArrayRef. It currently works for:

  • Str

  • ArrayRef

  • CodeRef

  • DataFlow::Role::Processor

using the same rules as in the subtype Processor described above. Anything else will trigger an error.

from Str

An ArrayRef will be created wrapping a named processor, as described in the coercion section of the Processor subtype above.

from CodeRef

An ArrayRef will be created wrapping a processor, as described in the coercion section of the Processor subtype above.

from DataFlow::Role::Processor

An ArrayRef will be created wrapping the processor, as described in the coercion section of the Processor subtype above.

WrappedProcList

An ArrayRef of DataFlow::ProcWrapper objects, with at least one element.

Coercions

from ArrayRef

Attempts to make DataFlow::ProcWrapper objects out of different things provided in an ArrayRef. It currently works for:

  • Str

  • ArrayRef

  • CodeRef

  • DataFlow::Role::Processor

using the same rules as in the subtype Processor described above and wrapping the resulting Processor in a DataFlow::ProcWrapper object. Anything else will trigger an error.

from Str

An ArrayRef will be created wrapping a named processor, as described in the coercion section of the Processor subtype above and wrapping the resulting Processor in a DataFlow::ProcWrapper object.

from CodeRef

An ArrayRef will be created wrapping a processor, as described in the coercion section of the Processor subtype above and wrapping the resulting Processor in a DataFlow::ProcWrapper object.

from DataFlow::Role::Processor

An ArrayRef will be created wrapping the processor, as described in the coercion section of the Processor subtype above and wrapping the resulting Processor in a DataFlow::ProcWrapper object.

ProcessorSub

A CodeRef, with coercions.

Coercions

from DataFlow::Role::Processor

An ArrayRef will be created wrapping the processor. The rules used above for DataFlow::Role::Processor elements in the ArrayRef apply.

ConversionDirection

An enumeration used by type DataFlow::Proc::Converter, containing two elements:

  • CONVERT_TO

    Indicates the conversion will occur towards a specified type

  • CONVERT_FROM

    Conversely, indicates the conversion will occur from a specfied type

See DataFlow::Proc::Converter for more information.

ConversionSubs

A HashRef[CodeRef] also used by DataFlow::Proc::Converter. It must have two keys only, 'CONVERT_TO' and 'CONVERT_FROM', holding a code reference (sub) for each of those.

See DataFlow::Proc::Converter for more information.

Decoder

A CodeRef used by DataFlow::Proc::Encoding. It will be used to decode strings from some particular character encoding to Perl's internal representation.

Coercions

from Str

It will automagically create a sub that uses function decode() from module Encode to decode from a named encoding.

Encoder

A CodeRef used by DataFlow::Proc::Encoding. It will be used to encode strings from Perl's internal representation to some particular character encoding.

Coercions

from Str

It will automagically create a sub that uses function encode() from module Encode to encode to a named encoding.

SEE ALSO

Please see those modules/websites for more information related to this module.

AUTHOR

Alexei Znamensky <russoz@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Alexei Znamensky.

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

BUGS AND LIMITATIONS

You can make new bug reports, and view existing ones, through the web interface at http://rt.cpan.org.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.