# TOP LEVEL methods
-# TODO: delete for both FTP and SSH2
sub get {
my $self = shift;
}
}
+sub delete {
+ my $self = shift;
+ my $params = shift;
+
+ $params = {remote_file => $params} unless ref $params;
+ $self->init($params); # secondary init
+
+ my $file = $params->{remote_file};
+
+ if (!$file) {
+ $logger->warn("No file specified for deletion");
+ return undef;
+ }
+
+ $logger->info("Deleting remote file '$file'");
+
+ if ($self->type eq "FTP") {
+ return $self->delete_ftp($file);
+ } else {
+ my %keys = $self->key_check($params);
+ return $self->delete_ssh2(\%keys, $file);
+ }
+}
+
+
# Checks if the filename part of a pathname has one or more glob characters
# We split out the filename portion of the path
# Detect glob or no glob.
}
+sub delete_ssh2 {
+ my $self = shift;
+ my $keys = shift;
+ my $file = shift;
+ my $sftp = $self->_ssh2($keys)->sftp;
+ return $sftp->unlink($file);
+}
+
sub _slash_path {
my $self = shift;
my $dir = shift || '.';
return @list;
}
-sub delete_ftp { # XXX not yet used
- $_[0]->_ftp->delete($_[1]);
+sub delete_ftp {
+ my $self = shift;
+ my $file = shift;
+ return $self->_ftp->delete($file);
}
sub _pkg { # Not OO