line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# This file is part of File-HomeDir-PathClass |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# This software is copyright (c) 2010 by Jerome Quelin. |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it under |
7
|
|
|
|
|
|
|
# the same terms as the Perl 5 programming language system itself. |
8
|
|
|
|
|
|
|
# |
9
|
2
|
|
|
2
|
|
31906
|
use 5.010; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
81
|
|
10
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
61
|
|
11
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
112
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package File::HomeDir::PathClass; |
14
|
|
|
|
|
|
|
BEGIN { |
15
|
2
|
|
|
2
|
|
41
|
$File::HomeDir::PathClass::VERSION = '1.112060'; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
# ABSTRACT: File::HomeDir returning Path::Class objects |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
2
|
|
9
|
use File::HomeDir 0.93 (); |
|
2
|
|
|
|
|
193
|
|
|
2
|
|
|
|
|
39
|
|
20
|
2
|
|
|
2
|
|
1616
|
use Path::Class; |
|
2
|
|
|
|
|
192894
|
|
|
2
|
|
|
|
|
211
|
|
21
|
2
|
|
|
|
|
28
|
use Sub::Exporter -setup => { |
22
|
|
|
|
|
|
|
exports => [ @File::HomeDir::EXPORT_OK ], |
23
|
|
|
|
|
|
|
#groups => { }, |
24
|
2
|
|
|
2
|
|
2246
|
}; |
|
2
|
|
|
|
|
27730
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# wrap all file::homedir relevant methods |
28
|
|
|
|
|
|
|
foreach my $sub ( @File::HomeDir::EXPORT_OK ) { |
29
|
2
|
|
|
2
|
|
1199
|
no strict 'refs'; ## no critic |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
316
|
|
30
|
|
|
|
|
|
|
# create a new sub... |
31
|
|
|
|
|
|
|
*{ $sub } = sub { |
32
|
8
|
100
|
66
|
8
|
|
8017
|
shift if defined($_[0]) && $_[0] eq __PACKAGE__; |
33
|
|
|
|
|
|
|
# ... that just pass through to file::homedir method... |
34
|
8
|
|
|
|
|
15
|
my $result = *{"File::HomeDir::$sub"}->(@_); |
|
8
|
|
|
|
|
56
|
|
35
|
|
|
|
|
|
|
# ... and wrap the result as a path::class object |
36
|
8
|
|
|
|
|
393
|
return dir( $result ); |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=pod |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
File::HomeDir::PathClass - File::HomeDir returning Path::Class objects |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 VERSION |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
version 1.112060 |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 SYNOPSIS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
use File::HomeDir::PathClass '-all'; |
56
|
|
|
|
|
|
|
my $home = home(); |
57
|
|
|
|
|
|
|
# $home is a Path::Class object now |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# - or - |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
use File::HomeDir::PathClass; |
62
|
|
|
|
|
|
|
my $home = File::HomeDir::PathClass->home; |
63
|
|
|
|
|
|
|
# $home is a Path::Class object now |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 DESCRIPTION |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
This module is just a wrapper around L methods, |
68
|
|
|
|
|
|
|
transforming their return value to L objects. This allows |
69
|
|
|
|
|
|
|
for easier usage of the value. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Refer to L for a list of which functions are |
72
|
|
|
|
|
|
|
supported. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
C supports both original L interfaces. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 Procedural mode |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
All functions are exportable. Nothing is exported by default, though. |
79
|
|
|
|
|
|
|
One has to list which function(s) she wants to import. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Some groups are defined for your convenience: |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=over 4 |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item * C - all available functions. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=back |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Note that this module is exporting subs via L, so groups |
90
|
|
|
|
|
|
|
are available either as C<:group> or C<-group>. One can also play any |
91
|
|
|
|
|
|
|
trick supported by L, check its documentation for further |
92
|
|
|
|
|
|
|
information. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 Class method mode |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Otherwise, functions are available as class methods, called as: |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
File::HomeDir::PathClass->method(); |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
In this case, one doesn't need to import anything during module use-age. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=for Pod::Coverage home my_.* users_.* |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 SEE ALSO |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Find other relevant information in L and L. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
You can also look for information on this module at: |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=over 4 |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
L |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item * CPAN Ratings |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
L |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item * Open bugs |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
L |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item * Git repository |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
L. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=back |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 AUTHOR |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Jerome Quelin |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
This software is copyright (c) 2010 by Jerome Quelin. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
139
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
__END__ |