in reply to Print debug information from Net::FTP

First, for clarity, you want to indent the code within each subroutine, e.g.
sub sendFile { # application object my $self = shift; # load template files my $tmpl = $self->param('info' => $self->load_tmpl('info.phtml') +); ... }
Re: your question of where the bug is, I think it's here:
# get the filename my $filename = "dir+filename"; # check if file exist if(-e $filename){
  1. Is the actual path of the file you want to send really "dir+filename"? Or was that intended to be a note to yourself to assign it something like "/home/boboson/media/mp3.mp3"?
  2. You may want to replace your -e $filename test with -f $filename, as the former tests only for existence, the latter tests if it's an actual plain file. See the perldoc for more info and other tests you can run.

-- Burvil

Replies are listed 'Best First'.
Re^2: Print debug information from Net::FTP
by boboson (Monk) on Apr 01, 2006 at 18:58 UTC
    dir+filename is not my actual code, I just didn't wan't to display the complete path.
    The code works, but not all of the time. It works approx. 3 out of 4 times.
    Thanks for the -f tip!
      What's the specific timeout message you're getting? Also, have you tried setting the debug level to something higher? According to the Net::Cmd docs (since Net::FTP inherits from Net::Cmd), the debug level may be set to more than 1, and different packages give different response.

      Update: You might also try using a network sniffer (if that's allowed on your network) to see what's actually being passed between your Linux and Windows box. Ethereal comes installed on a lot of linux distros, and has a pretty nice GUI, or, if you prefer the command line, you can use tcpdump.

      -- Burvil

        Error executing run mode 'send_file': Cannot connect to host: Net::FTP: connect: timeout at /home/domains/xxx/www.xxx.com/aa/system/modules//FTP.pm line 16. at /home/domains/xxx/www.xxx.com/aa/index.cgi line 20
        I don't know how to se the result of the debug information!