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

First of all, I would say I'm a novice at perl and I installed it on a Windows server for the very first time yesterday. (5.8.6). I have run this code snippet on a version of perl on linux (one that I did not install) and it runs fine, but running it on the perl I installed on the Windows server produces this error message: +555 Encryption mode unknown! (EXP_CRYPT) Can anyone help? Code snippet: my $ftps = Net::FTPSSL->new( 'mvsb.xxxxx.net', Port => 21, Encryption => EXP_CRYPT, Debug => 1 ); if (!defined($ftps)) { die; }

Replies are listed 'Best First'.
Re: Trouble with NET::FTPSSL
by syphilis (Archbishop) on Jun 11, 2011 at 02:42 UTC
    Are you sure you didn't code it as:
    Encryption => 'EXP_CRYPT', or Encryption => "EXP_CRYPT",
    Looking at the module's source, I think it needs to be a bareword Encryption => EXP_CRYPT (ie no quotes).
    And the error message you've supplied is consistent with EXP_CRYPT having been quoted, and inconsistent with EXP_CRYPT having been unquoted.

    The error arises from this check in FTPSSL.pm:
    return _croak_or_return (undef, $die, $dbg_flg, "Encryption mode unknown! ($encrypt_mode)" +) if ( $encrypt_mode ne IMP_CRYPT && $encrypt_mode ne EXP_CRYPT && $encrypt_mode ne CLR_CRYPT );
    Near the beginning of FTPSSL.pm we have:
    use constant EXP_CRYPT => "E";
    Therefore, if FTPSSL.pm's $encrypt_mode has been assigned as you intend, it should have been set to E, not EXP_CRYPT as the error reports.

    At least that's the way it looks to me.

    Cheers,
    Rob

    UPDATE: Alternatively, it might be that you haven't imported EXP_CRYPT - in which case that could be fixed by specifying:
    Encryption => Net::FTPSSL::EXP_CRYPT,
    Without seeing more of your code, it's hard to know for sure.
    (Also fixed typos in my initial post.)
Re: Trouble with NET::FTPSSL
by Khen1950fx (Canon) on Jun 11, 2011 at 03:53 UTC
    if(not defined($ftps)) { die; } It's unnecessary because you use Debug => 1,. You're much better off using Croak => 1 in the constructor. The values for port and encryption are default, so you don't have to list them. Here's what I think you were after:
    #!/usr/bin/perl use strict; use warnings; use Net::FTPSSL; my $ftps = Net::FTPSSL->new( 'ftp.cpan.org', Debug => 1, Croak => 1 );