[html-formfu] applying a filter

Carl Franks fireartist at gmail.com
Fri Mar 20 08:15:52 GMT 2009


2009/3/19 David Schmidt <davewood at gmx.at>:
> I am using the transformer in the form where I create a new user and
> insert username and password into the database.
> But the password hash that is inserted into the database doesnt match
> with the one I get when I execute the same command on the commandline.

Callback subroutines are passed the arguments ($value, \%params)

print sha1_hex('password');
    5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8
print sha1_hex('password', {});
    71252337f7555e49ec5eaa05c8026c846057e404
print sha1_hex('password', { a => 'b', c => 'd' });
    e0613e6de2ebadf9cdfe59a27b251f74ea3052cf
print sha1_hex('password', { c => 'd', a => 'b' });
    f229018fb7726a0ecb73b3b621e1074dbb8763fd

Callback.pm was never intended for use with arbitrary subroutines.
It's unfortunate that someone tried it and thought it worked.

The above code shows that it can't possibly work reliably.
If the value for a submit button changes, it breaks your hashed-values.
If you add a new hidden field, it breaks...
If the order of hash keys changes (which is guaranteed with perl), it breaks...

I'll check the docs and make sure there are no examples of this there.

Carl



More information about the HTML-FormFu mailing list