I have been tasked to add some features to my company's Perl API to allow
for the encryption of credit card information. I am using the Perl implemenation
of the Blowfish encryption algorythm (Blowfish_PP) and Crypt::CBC modules to
do this. I am also using the ConfigFiles module to get the key information from
the .ini file. To make sure my module worked, I wrote a short script to test it,
but I received the following back:
Encryption.pm did not return a true value at test.pl line 3.
BEGIN failed--compilation aborted at test.pl line 3
This is the test script I wrote:
#!/usr/bin/perl -w
use strict;
use Encryption;
my $ENC=Encryption->new();
my $TestString="This is a test";
my $EncryptedString = $ENC->encrypt_acctnumber($TestString);
print"\$EncryptedString is : $EncryptedString";
And here is the module:
#!/usr/bin/perl -w
use strict;
use ConfigFile;
use CBC;
use Blowfish_PP;
use Env qw (INI);
package Encryption;
sub new{
my $pkg = shift;
# Default to the .ini file in the current directory
if(!defined($INI)){
$INI = "test.ini";
}
# Read the .ini file for the key setting
my $ini = ConfigFile->new($INI);
my $KEY = $ini->Parameter('Key','1');
# Create the Encryption object
my $CBC = new CBC($KEY,'Blowfish');
return bless $pkg;
}
sub encrypt_acctnumber{
my $encrypted=$CBC->encrypt_hex($_[0]);
return $encrypted;
}
From what I can tell by the error code being returned, it can't even find the module
in question. Any help would be appreciated. Thanks in advance.
TStanley
In the end, there can be only one!
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.