http://qs1969.pair.com?node_id=499707


in reply to Re: Net::FTP pwd bug?
in thread Net::FTP

Hi,

If you are following the above code try something like :
#!/usr/bin/perl use Net::FTP; my $destserv="ftp.myhost.com"; my $destuser="username"; my $destpass="password"; $ftp = Net::FTP->new($destserv) or die "error connecting\n"; $ftp->login($destuser,$destpass); my $mypath = $ftp->pwd(); $ftp->quit(); print "FTP Path: $mypath";
Keep in mind that this is untested, its late and I am seriously sleep deprived.
Have you checked out the documentation? There is a link to examples you can also have a look at.

Hope this helps

Martin

Replies are listed 'Best First'.
Re^3: Net::FTP pwd bug?
by mikeock (Hermit) on Oct 12, 2005 at 22:59 UTC

    When that variable is added  my $mypath = $ftp->pwd(): to my code, I get the same results as just trying to call  $ftp->pwd();

    And by the same I mean that there is no repsonse at all. The Box that has the server on it allows me to login and type pwd so I know that it is supported on the server.

      Have you tried trapping for errors similar to the code in grantm's post above?:
      my $path = $ftp->pwd() or die "pwd failed: " . $ftp->code() . ": " . $ftp->message(); print "$path\n";
        Hmmm.... Copied
        my $path = $ftp->pwd() or die "pwd failed: " . $ftp->code() . ": " . $ftp->message(); print "$path\n";
        Directly and it seems to work... (I get the path!)

        What was I doing wrong?

        Edit Da der I forgot to print the path! I got it now