line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Verby::Action::MkPath; |
4
|
2
|
|
|
2
|
|
71809
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
with qw/Verby::Action/; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use File::Path qw/mkpath/; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = "0.05"; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub do { |
13
|
|
|
|
|
|
|
my $self = shift; |
14
|
|
|
|
|
|
|
my $c = shift; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $path = $c->path; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
if ( !defined($path) || !length($path) ){ |
19
|
|
|
|
|
|
|
$c->logger->log_and_die(level => "error", message => "invalid path"); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
$c->logger->info("creating path '$path'"); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
mkpath($path) |
25
|
|
|
|
|
|
|
or $c->logger->log_and_die(level => "error", message => "couldn't mkpath('$path'): $!"); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
$self->confirm($c); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub verify { |
31
|
|
|
|
|
|
|
my $self = shift; |
32
|
|
|
|
|
|
|
my $c = shift; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
-d $c->path; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__PACKAGE__ |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=pod |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 NAME |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Verby::Action::MkPath - Action to create a directory path |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 SYNOPSIS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
use Verby::Step::Closure qw/step/; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
step "Verby::Action::MkPath" => sub { |
52
|
|
|
|
|
|
|
my ($self, $c) = @_; |
53
|
|
|
|
|
|
|
$c->path("/some/path/that/will/be/created"); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 DESCRIPTION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This Action uses L<File::Path/mkpath> to create a directory path. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 METHODS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=over 4 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item B<do> |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Creates the directory C<< $c->path >>. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item B<verfiy> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Ensures that the directory C<< $c->path >> exists. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=back |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 BUGS |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
None that we are aware of. Of course, if you find a bug, let us know, and we will be sure to fix it. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 CODE COVERAGE |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
We use B<Devel::Cover> to test the code coverage of the tests, please refer to COVERAGE section of the L<Verby> module for more information. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 SEE ALSO |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 AUTHOR |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Yuval Kogman, E<lt>nothingmuch@woobling.orgE<gt> |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Copyright 2005-2008 by Infinity Interactive, Inc. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
L<http://www.iinteractive.com> |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
95
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |