Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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!

In reply to Creating a module by TStanley

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2023-02-07 20:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (40 votes). Check out past polls.

    Notices?