Hadoop-HDFS-Command
view release on metacpan or search on metacpan
lib/Hadoop/HDFS/Command.pm view on Meta::CPAN
has trace_logs => (
is => 'rw',
isa => Bool,
default => sub { 0 },
lazy => 1,
);
has runas => (
is => 'rw',
isa => Str,
default => scalar getpwuid $<,
lazy => 1,
);
before ['_capture', '_capture_with_stdin'] => sub {
my ($self, $options, @cmd) = @_;
unshift @cmd, 'sudo', '-u', $self->runas
unless $self->runas eq getpwuid $<;
@_ = ($self, $options, @cmd);
};
sub dfs {
my $self = shift;
my $options = Ref::Util::is_hashref $_[0] ? shift( @_ ) : {};
(my $cmd = shift || die "No dfs command specified") =~ s{ \A [-]+ }{}xms;
my $method = '_dfs_' . $cmd;
Carp::croak "'$cmd' is not implemented!" if ! $self->can( $method );
$self->$method( $options, @_ );
( run in 0.244 second using v1.01-cache-2.11-cpan-8d75d55dd25 )