| 1 | 2 | ▶ | use 5.008001; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | package MooseX::Types::Path::Class::MoreCoercions; | ||||||||||
| 6 | # ABSTRACT: More powerful coercion than MooseX::Types::Path::Class | ||||||||||
| 7 | 2 | our $VERSION = '0.003'; # VERSION | |||||||||
| 8 | |||||||||||
| 9 | 2 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 2 | ▶ | use MooseX::Types::Stringlike qw/Stringable/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 2 | ▶ | use MooseX::Types::Path::Class (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 2 | ▶ | use Path::Class (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 2 | ▶ | use MooseX::Types -declare => [qw( Dir File AbsDir AbsFile )]; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 2 | subtype Dir, as MooseX::Types::Path::Class::Dir; | |||||||||
| 16 | coerce( Dir, | ||||||||||
| 17 | 2 | @{ MooseX::Types::Path::Class::Dir->coercion->type_coercion_map }, | |||||||||
| 18 | 3 | ▶ | from Stringable, via { Path::Class::Dir->new("$_") }, | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 2 | ); | |||||||||
| 20 | |||||||||||
| 21 | 2 | subtype File, as MooseX::Types::Path::Class::File; | |||||||||
| 22 | coerce( File, | ||||||||||
| 23 | 2 | @{ MooseX::Types::Path::Class::File->coercion->type_coercion_map }, | |||||||||
| 24 | 3 | ▶ | from Stringable, via { Path::Class::File->new("$_") }, | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 25 | 2 | ); | |||||||||
| 26 | |||||||||||
| 27 | subtype AbsDir, | ||||||||||
| 28 | as Dir, | ||||||||||
| 29 | 4 | ▶ | where { $_->is_absolute }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 30 | |||||||||||
| 31 | coerce( AbsDir, | ||||||||||
| 32 | 3 | ▶ | ( map { my $c = $_; (ref $c eq "CODE") ? sub { $c->(@_)->absolute } : $c } | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||
| 33 | 2 | @{ Dir->coercion->type_coercion_map } | |||||||||
| 34 | ), | ||||||||||
| 35 | 0 | ▶ | from Dir, via { $_->absolute }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 36 | 2 | ); | |||||||||
| 37 | |||||||||||
| 38 | subtype AbsFile, | ||||||||||
| 39 | as File, | ||||||||||
| 40 | 4 | ▶ | where { $_->is_absolute }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 41 | |||||||||||
| 42 | coerce( AbsFile, | ||||||||||
| 43 | 3 | ▶ | ( map { my $c = $_; (ref $c eq "CODE") ? sub { $c->(@_)->absolute } : $c } | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||
| 44 | 2 | @{ File->coercion->type_coercion_map } | |||||||||
| 45 | ), | ||||||||||
| 46 | 0 | ▶ | from File, via { $_->absolute }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 47 | 2 | ); | |||||||||
| 48 | |||||||||||
| 49 | 2 | 1; | |||||||||
| 50 | |||||||||||
| 51 | |||||||||||
| 52 | # vim: ts=2 sts=2 sw=2 et: | ||||||||||
| 53 | |||||||||||
| 54 | __END__ | ||||||||||