Skip to content

Commit 17d2829

Browse files
committed
Implement `chmod' subcommand
1 parent 8454d9e commit 17d2829

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
@@ -352,6 +352,31 @@ sub _dfs_mkdir {
352352
return @response
353353
}
354354

355+
sub _dfs_chmod {
356+
my $self = shift;
357+
my $options = shift;
358+
my @params = @_;
359+
my @flags = qw( p );
360+
my($arg, $paths) = $self->_parse_options(
361+
\@params,
362+
\@flags,
363+
undef,
364+
{
365+
require_params => 1,
366+
},
367+
);
368+
my @response = $self->_capture(
369+
$options,
370+
$self->cmd_hdfs,
371+
qw( dfs -chmod ),
372+
( map { '-' . $_ } grep { $arg->{ $_ } } @flags ),
373+
@{ $paths },
374+
);
375+
376+
# just a confirmation message
377+
return @response
378+
}
379+
355380
sub _parse_options {
356381
my $self = shift;
357382
# TODO: collect dfs generic options
@@ -653,6 +678,12 @@ The C<@subcommand_args> can have these defined: C<-p>
653678
654679
$hdfs->dfs( mkdir => @subcommand_args, $path );
655680
681+
=head3 chmod
682+
683+
The C<@subcommand_args> can have these defined: C<-R>
684+
685+
$hdfs->dfs( chmod => @subcommand_args, $mode, $path );
686+
656687
=head1 SEE ALSO
657688
658689
C<`hdfs dfs -help`>.

0 commit comments

Comments
 (0)