Skip to content

Commit 8454d9e

Browse files
committed
Implement `mkdir' subcommand
1 parent 1454191 commit 8454d9e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

lib/Hadoop/HDFS/Command.pm

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,31 @@ sub _dfs_test {
327327
} or return 0;
328328
}
329329

330+
sub _dfs_mkdir {
331+
my $self = shift;
332+
my $options = shift;
333+
my @params = @_;
334+
my @flags = qw( p );
335+
my($arg, $paths) = $self->_parse_options(
336+
\@params,
337+
\@flags,
338+
undef,
339+
{
340+
require_params => 1,
341+
},
342+
);
343+
my @response = $self->_capture(
344+
$options,
345+
$self->cmd_hdfs,
346+
qw( dfs -mkdir ),
347+
( map { '-' . $_ } grep { $arg->{ $_ } } @flags ),
348+
@{ $paths },
349+
);
350+
351+
# just a confirmation message
352+
return @response
353+
}
354+
330355
sub _parse_options {
331356
my $self = shift;
332357
# TODO: collect dfs generic options
@@ -622,6 +647,12 @@ The C<@subcommand_args> can have these defined: C<-d>, C<-e>, C<-f>, C<-s>, C<-z
622647
623648
$hdfs->dfs( test => @subcommand_args, $hdfs_path );
624649
650+
=head3 mkdir
651+
652+
The C<@subcommand_args> can have these defined: C<-p>
653+
654+
$hdfs->dfs( mkdir => @subcommand_args, $path );
655+
625656
=head1 SEE ALSO
626657
627658
C<`hdfs dfs -help`>.

0 commit comments

Comments
 (0)