TStanley has asked for the wisdom of the Perl Monks concerning the following question:
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:
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:
And here is the module:
in question. Any help would be appreciated. Thanks in advance.
TStanley
In the end, there can be only one!
#!/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:
From what I can tell by the error code being returned, it can't even find 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; }
in question. Any help would be appreciated. Thanks in advance.
TStanley
In the end, there can be only one!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Creating a module
by japhy (Canon) on Feb 13, 2001 at 17:14 UTC | |
by TStanley (Canon) on Feb 13, 2001 at 17:19 UTC | |
Re: Creating a module
by Crulx (Monk) on Feb 13, 2001 at 17:35 UTC | |
Re: Creating a module
by davorg (Chancellor) on Feb 13, 2001 at 17:17 UTC | |
by Anonymous Monk on Mar 05, 2003 at 13:55 UTC |
Back to
Seekers of Perl Wisdom