The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MooseX::Types::IO::All - IO::All related constraints and coercions for Moose

SYNOPSIS

    package Foo;

    use Moose;
    use MooseX::Types::IO::All 'IO_All';

    has io => (
        isa => IO_All,
        is  => "rw",
        coerce => 1,
    );

    # later
    my $str = "test for IO::String\n line 2";
    my $foo = Foo->new( io => \$str );
    my $io  = $foo->io; # IO::All::String
    # or
    my $filename = "file.txt";
    my $foo = Foo->new( io => $filename );
    my $io  = $foo->io; # IO::All

DESCRIPTION

This module packages one Moose::Util::TypeConstraints with coercions, designed to work with the IO::All suite of objects.

CONSTRAINTS

Str
    io $_;

IO::All object.

ScalarRef
    my $s = io('$');
    $s->print($$_);

IO::All::String object. so generally u need

    ${ $s->string_ref } # the content

instead of ->all or ->slurp

SEE ALSO

Moose, MooseX::Types, MooseX::Types::IO, IO::All

AUTHOR

Fayland Lam, <fayland at gmail.com>

ACKNOWLEDGEMENTS

The Moose Team

COPYRIGHT & LICENSE

Copyright 2008 Fayland Lam, all rights reserved.

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