| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MouseX::Types::Path::Class; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
695449
|
use 5.008_001; |
|
|
3
|
|
|
|
|
14
|
|
|
|
3
|
|
|
|
|
152
|
|
|
4
|
3
|
|
|
3
|
|
21
|
use strict; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
126
|
|
|
5
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
|
3
|
|
|
|
|
22
|
|
|
|
3
|
|
|
|
|
113
|
|
|
6
|
3
|
|
|
3
|
|
1074
|
use Path::Class (); |
|
|
3
|
|
|
|
|
505370
|
|
|
|
3
|
|
|
|
|
95
|
|
|
7
|
3
|
|
|
3
|
|
16633
|
use MouseX::Types -declare => [qw(Dir File)]; # export Types |
|
|
3
|
|
|
|
|
109436
|
|
|
|
3
|
|
|
|
|
33
|
|
|
8
|
3
|
|
|
3
|
|
5515
|
use MouseX::Types::Mouse qw(Str ArrayRef); |
|
|
3
|
|
|
|
|
874
|
|
|
|
3
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
class_type 'Path::Class::Dir'; |
|
13
|
|
|
|
|
|
|
class_type 'Path::Class::File'; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
subtype Dir, as 'Path::Class::Dir'; |
|
16
|
|
|
|
|
|
|
subtype File, as 'Path::Class::File'; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
for my $type ( 'Path::Class::Dir', Dir ) { |
|
19
|
|
|
|
|
|
|
coerce $type, |
|
20
|
|
|
|
|
|
|
from Str, via { Path::Class::Dir->new($_) }, |
|
21
|
|
|
|
|
|
|
from ArrayRef, via { Path::Class::Dir->new(@$_) }; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
for my $type ( 'Path::Class::File', File ) { |
|
25
|
|
|
|
|
|
|
coerce $type, |
|
26
|
|
|
|
|
|
|
from Str, via { Path::Class::File->new($_) }, |
|
27
|
|
|
|
|
|
|
from ArrayRef, via { Path::Class::File->new(@$_) }; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# optionally add Getopt option type |
|
31
|
|
|
|
|
|
|
eval { require MouseX::Getopt }; |
|
32
|
|
|
|
|
|
|
unless ($@) { |
|
33
|
|
|
|
|
|
|
MouseX::Getopt::OptionTypeMap->add_option_type_to_map($_, '=s') |
|
34
|
|
|
|
|
|
|
for ( 'Path::Class::Dir', 'Path::Class::File', Dir, File ); |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
MouseX::Types::Path::Class - A Path::Class type library for Mouse |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 CLASS TYPES |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
package MyApp; |
|
48
|
|
|
|
|
|
|
use Mouse; |
|
49
|
|
|
|
|
|
|
use MouseX::Types::Path::Class; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
has 'dir' => ( |
|
52
|
|
|
|
|
|
|
is => 'ro', |
|
53
|
|
|
|
|
|
|
isa => 'Path::Class::Dir', |
|
54
|
|
|
|
|
|
|
required => 1, |
|
55
|
|
|
|
|
|
|
coerce => 1, |
|
56
|
|
|
|
|
|
|
); |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
has 'file' => ( |
|
59
|
|
|
|
|
|
|
is => 'ro', |
|
60
|
|
|
|
|
|
|
isa => 'Path::Class::File', |
|
61
|
|
|
|
|
|
|
required => 1, |
|
62
|
|
|
|
|
|
|
coerce => 1, |
|
63
|
|
|
|
|
|
|
); |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 CUSTOM TYPES |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
package MyApp; |
|
68
|
|
|
|
|
|
|
use Mouse; |
|
69
|
|
|
|
|
|
|
use MouseX::Types::Path::Class qw(Dir File); |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
has 'dir' => ( |
|
72
|
|
|
|
|
|
|
is => 'ro', |
|
73
|
|
|
|
|
|
|
isa => Dir, |
|
74
|
|
|
|
|
|
|
required => 1, |
|
75
|
|
|
|
|
|
|
coerce => 1, |
|
76
|
|
|
|
|
|
|
); |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
has 'file' => ( |
|
79
|
|
|
|
|
|
|
is => 'ro', |
|
80
|
|
|
|
|
|
|
isa => File, |
|
81
|
|
|
|
|
|
|
required => 1, |
|
82
|
|
|
|
|
|
|
coerce => 1, |
|
83
|
|
|
|
|
|
|
); |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
MouseX::Types::Path::Class creates common L types, |
|
88
|
|
|
|
|
|
|
coercions and option specifications useful for dealing |
|
89
|
|
|
|
|
|
|
with L objects as L attributes. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Coercions (see L) are made |
|
92
|
|
|
|
|
|
|
from both C and C to both L and |
|
93
|
|
|
|
|
|
|
L objects. |
|
94
|
|
|
|
|
|
|
If you have L installed, |
|
95
|
|
|
|
|
|
|
the Getopt option type ("=s") will be added for both |
|
96
|
|
|
|
|
|
|
L and L. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 TYPES |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 Dir |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=over 4 |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
A L class type. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Coerces from C and C via L. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=back |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 File |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=over 4 |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
A L class type. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Coerces from C and C via L. |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=back |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 AUTHOR |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
NAKAGAWA Masaki Emasaki@cpan.orgE |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 THANKS TO |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
L |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 LICENSE |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
131
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
L, L, |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
L, |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
L |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |