WintersMystic has asked for the wisdom of the Perl Monks concerning the following question:

the following is the error i get when i try to use NET::FTP, im on a webhost not working of PC. [Thu Oct 25 01:05:39 2001] FTP.pm: Can't locate NET/FTP.pm in @INC (@INC contains: /usr/lib/perl5/5.6.0/i686-linux /usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i686-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl .) at TL.pl line 16. BEGIN failed--compilation aborted at TL.pl line 16 i know NET::FTP is on my host, cause it is listed in their module listing.

thanx for any and all help :)

Edit: chipmunk 2001-10-25

Replies are listed 'Best First'.
Re: NET::FTP error question
by runrig (Abbot) on Oct 25, 2001 at 09:52 UTC
    NET::FTP is spelled 'Net::FTP'. Case matters on some systems.

    Update: To clarify tye's reply, and my own post, on case-insensitive systems, this will work (assuming we're trying to use the Net::FTP module):

    use NET::FTP;
    but this won't:
    my $ftp = NET::FTP->new("hostname");
    On case-sensitive systems, the first statement will fail, as would the second if it ever got executed.

      ...and the case used in module names matters to Perl on all systems.

              - tye (but my friends call me "Tye")
Re: NET::FTP error question
by Armos (Scribe) on Oct 25, 2001 at 16:14 UTC
    As mentioned above, case sensitivity matters on some platforms. Something else to consider, is that you might not have read permissions on that file for some oddball reason. You might have to contact your host if changing the case doesn't work...

    -A
Re: NET::FTP error question
by WintersMystic (Novice) on Oct 26, 2001 at 02:23 UTC
    ok, i changed NET::FTP to Net:FTP and now that problem isnt around. but i have another prob. (im very new to workin with modules, sorry)

    i get a Bad file descriptor at TL.pl line 25. line 25 being $ftp->get any help is very apreciated.

    use Net::FTP; $ftp = Net::FTP->new("$host", debug => 1) or die "Host: $!"; $ftp->login($user,$pass) or die "Login: $!"; $ftp->cwd() or die "Dir: $!"; $ftp->get("$file","$dir\/$file") or die "File: $!"; $ftp->quit;
      A line by line critique:
      use Net::FTP; # You should 'use strict' if the final script is # going to be any longer than 5 or 10 lines, # which would make the next line 'my $ftp = ...'. # Also, according to the Net::FTP docs, connect # errors are reported in $@, not $! $ftp = Net::FTP->new("$host", debug => 1) or die "Host: $!"; # Error messages after new are reported in the # message() method ($ftp->message, and don't put it inside # quotes since methods won't get interpolated inside # quotes). This method is documented in Net::Cmd, which # Net::FTP inherits from. # Are $user and $pass set to anything? $ftp->login($user,$pass) or die "Login: $!"; # Same comment as above. $ftp->cwd() or die "Dir: $!"; # Are $file and $dir set to anything? # Does $dir exist on the local system? # Does $file exist in the current directory # on the remote system? # Is there a permission problem? # And you don't need to backwhack the "/" $ftp->get("$file","$dir\/$file") or die "File: $!"; $ftp->quit;
      Also, in general, you don't need to put quotes around just a single variable, e.g. "$file", though some people consider it a matter of preference.
      And again, Use strict and warnings :-)
        Just wanted to say thanks to runrig, the line by line critique pointed out a (sadly) basic error I was having problems with doing something similar, but not directly related to this thread. When people take the time to fully explain like this it is amazing how much good can result, even on off topic matters. Thanks for your excellent commentary!
        -Mike Gucciard
        -Neophyte Perl Coder
        -owner@funevilpeople.org