line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Path::Stderr; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
28664
|
use 5.005; # yes, really |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
82
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
85
|
|
6
|
|
|
|
|
|
|
#use warnings; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
20
|
use File::Path (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
742
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
require Exporter; |
11
|
|
|
|
|
|
|
@File::Path::Stderr::ISA = qw(Exporter); |
12
|
|
|
|
|
|
|
@File::Path::Stderr::EXPORT = qw(mkpath rmpath); |
13
|
|
|
|
|
|
|
@File::Path::Stderr::EXPORT_OK = qw(make_path remove_tree); |
14
|
|
|
|
|
|
|
$File::Path::Stderr::VERSION = "2.00"; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
File::Path::Stderr - like File::Path but print to STDERR |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use File::Path::Stderr qw(make_path remove_tree); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
make_path('foo/bar/baz', '/zug/zwang'); |
25
|
|
|
|
|
|
|
make_path('foo/bar/baz', '/zug/zwang', { |
26
|
|
|
|
|
|
|
verbose => 1, |
27
|
|
|
|
|
|
|
mode => 0711, |
28
|
|
|
|
|
|
|
}); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
remove_tree('foo/bar/baz', '/zug/zwang'); |
31
|
|
|
|
|
|
|
remove_tree('foo/bar/baz', '/zug/zwang', { |
32
|
|
|
|
|
|
|
verbose => 1, |
33
|
|
|
|
|
|
|
error => \my $err_list, |
34
|
|
|
|
|
|
|
}); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# legacy (interface promoted before v2.00) |
37
|
|
|
|
|
|
|
mkpath('/foo/bar/baz'); |
38
|
|
|
|
|
|
|
mkpath('/foo/bar/baz', 1, 0711); |
39
|
|
|
|
|
|
|
mkpath(['/foo/bar/baz', 'blurfl/quux'], 1, 0711); |
40
|
|
|
|
|
|
|
rmtree('foo/bar/baz', 1, 1); |
41
|
|
|
|
|
|
|
rmtree(['foo/bar/baz', 'blurfl/quux'], 1, 1); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# legacy (interface promoted before v2.06) |
44
|
|
|
|
|
|
|
mkpath('foo/bar/baz', '/zug/zwang', { verbose => 1, mode => 0711 }); |
45
|
|
|
|
|
|
|
rmtree('foo/bar/baz', '/zug/zwang', { verbose => 1, mode => 0711 }); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 DESCRIPTION |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
This is a very, very simple wrapper around B. All |
50
|
|
|
|
|
|
|
exported functions function exactly the same as they do in B |
51
|
|
|
|
|
|
|
except rather than printing activity reports to the currently selected |
52
|
|
|
|
|
|
|
filehandle (which is normally STDOUT) the messages about what B |
53
|
|
|
|
|
|
|
is doing are printed to STDERR. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 Functions |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
The following functions from File::Path are currently supported: |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=over |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item mkpath |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item rmpath |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item make_path |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item remove_tree |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=back |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
By default, if you don't request a particular import list, |
72
|
|
|
|
|
|
|
C and C will be exported by default. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub File::Path::Stderr::End::DESTORY { |
77
|
0
|
|
|
0
|
|
|
my $self = shift; |
78
|
0
|
|
|
|
|
|
return $self->(); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub _with_stdderr(&) { |
82
|
|
|
|
|
|
|
# remember what file handle was selected |
83
|
0
|
|
|
0
|
|
|
my $old = select(); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
# select STDERR instead |
86
|
0
|
|
|
|
|
|
select(STDERR); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# after we've returned (but before the next statement) |
89
|
|
|
|
|
|
|
# switch the file handle back to what it was before |
90
|
0
|
|
|
0
|
|
|
my $run_on_destroy = bless sub { select($old) }, "File::Path::Stderr::End"; |
|
0
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# run the passed codeblock |
93
|
0
|
|
|
|
|
|
return $_[0]->(); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
0
|
1
|
|
sub mkpath { return _with_stderr { File::Path::mkpath(@_); } } |
|
0
|
|
|
|
|
|
|
97
|
0
|
|
|
0
|
1
|
|
sub rmpath { return _with_stderr { File::Path::rmpath(@_); } } |
|
0
|
|
|
|
|
|
|
98
|
0
|
|
|
0
|
1
|
|
sub make_path { return _with_stderr { File::Path::make_path(@_); } } |
|
0
|
|
|
|
|
|
|
99
|
0
|
|
|
0
|
1
|
|
sub remove_tree { return _with_stderr { File::Path::remove_tree(@_); } } |
|
0
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 AUTHOR |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Written by Mark Fowler Emark@twoshortplanks.comE |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Copryright Mark Fowler 2003, 2012. All Rights Reserved. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Most of the SYNOPSIS stolen directly from File::Path. |
108
|
|
|
|
|
|
|
File::Path copyright (C) Charles Bailey, Tim Bunce and David |
109
|
|
|
|
|
|
|
Landgren 1995-2009. All rights reserved. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
This program is free software; you can redistribute it |
112
|
|
|
|
|
|
|
and/or modify it under the same terms as Perl itself. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 BUGS |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
None known. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Bugs should be reported to me via the CPAN RT system. |
119
|
|
|
|
|
|
|
L. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Alternatively, you can simply fork this project on github and |
122
|
|
|
|
|
|
|
send me pull requests. Please see |
123
|
|
|
|
|
|
|
L |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 SEE ALSO |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
L |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
1; |