+=item mkdir DIRECTORY
+
+Makes a directory on the remote server. Returns false and sets the B<errstr>
+attribute on errors.
+
+(Implementation note: An ssh connection is established to the remote machine
+and '/bin/mkdir B<-p>' is used to create the directory.)
+
+=cut
+
+sub mkdir {
+ my($self, $directory) = @_;
+ $directory = $self->{'cwd'}. "/$directory"
+ if $self->{'cwd'} && $directory !~ /^\//;
+ my $host = $self->{'host'};
+ $host = $self->{'user'}. '@'. $host if $self->{'user'};
+ my($reader, $writer, $error ) =
+ ( new IO::Handle, new IO::Handle, new IO::Handle );
+ $writer->autoflush(1);
+ my $pid = sshopen3( $host, $writer, $reader, $error,
+ '/bin/mkdir', '-p ', shell_quote($directory) );
+ waitpid $pid, 0;
+ if ( $? >> 8 ) {
+ chomp(my $errstr = <$error>);
+ $self->{errstr} = $errstr || "mkdir exited with status ". $?>>8;
+ return 0;
+ }
+ 1;
+}
+