Hi,
I have a perl module that has this function
sub passwd {
my $cleartext_pass=$_[0];
my $ppr = Authen::Passphrase::MD5Crypt->new(
salt_random => 1,
passphrase => $cleartext_pass);
my $passwdo = $ppr->as_crypt;
return $passwdo;
}
I use it in my scripts like this:
my $rela ... #This is the module that is "multi-level" and the DB part
+ has passwd function in it
...
if (param('pass') == param ('pass_again')) {
my $pass_clear=param('pass');
my $password=$rela->passwd($pass_clear);
$rela->do('INSERT INTO uzivatele (jmeno,prijmeni,heslo,login,s
+tav_uctu,skupina,vytvoren) VALUES (?, ?, ?, ?, 2, \'user\', CURRENT_T
+IMESTAMP)', param('jmeno'), param('prijmeni'), $password, param('logi
+n'));
Now the problem is when I run the function alone (not from the module) with a string like this:
my $test=passwd('hi');
it produces the right output (md5crypted password)
but when I use it from the module in my script (as shown above)
I get incorrect md5crypt code... The thing is that I pass the cleartext to passwd function from param ... I tried storing just the cleartext param (I changed the passwd function to return just
$cleartext_pass It stored something like :
My::Module = HASH(0x2ab7df04ba50) as password. So the problem is with passing it to the function from param. What am I doing wrong here?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.