dagolden/moosex-types-path-tiny — pull request #2 by tobyink (2013-05-20 14:36:27+00:00)
Title: Port MooseX::Types::Path::Tiny to Type::Tiny; improve diagnostics

This PR ports MooseX::Types::Path::Tiny from MooseX::Types to Type::Tiny. This allows the type constraints to work alike in Moose, Mouse and Moo, and removes the dependency on Moose.

On my netbook, it improves the speed of this simple benchmark, going from about 14 wallclock seconds to eight:

```perl
use strict;
use warnings;
use Benchmark "timethis";

{
package Foo;
use Moose;
use MooseX::Types::Path::Tiny qw(File);
has path => (is => "ro", isa => File, coerce => 1);
__PACKAGE__->meta->make_immutable;
}

timethis(100_000, 'Foo->new(path => "/etc/passwd")');
```

The PR also includes improved error messages. This is because if you use, say, `AbsFile` in an attribute with no coercion, you can end up with misleading error messages - passing it a string filename would tell you that the file does not exist. Now it provides a specific error message saying what's wrong (not isa Path::Tiny, not absolute, file/dir doesn't exist).

Test cases have been altered to check for the specific error messages. Test::Requires is used to skip tests if Moose is unavailable (because Moose is no longer a runtime requirement).