in reply to Example of complex constraint with HTML::FormValidator

I got it. It was combination of reading the docs more closely and translating them a bit. They say anonymous subroutine, but from reading the source code, it looks like a reference to a named subroutine will do as well. That gives me some more flexiblity. :) I think the constraint clause might look like this if I wanted to use a function called &customer that used two fields from the form, first_name and last_name to check the field field_to_check,:

constraints => field_to_check => { constraint => \&custom, params => [ qw( first_name last_name) ], }, }

-mark

Replies are listed 'Best First'.
Re (tilly) 2: Example of complex constraint with HTML::FormValidator
by tilly (Archbishop) on Mar 22, 2001 at 05:04 UTC
    An anonymous subroutine means a reference to a subroutine. That reference may be constructed from a real one, or from one created on the fly.

    There is little one can do with normal subroutines that cannot be done by storing anonymous subroutines in variables and calling them indirectly. (Exceptions include special subroutines like AUTOLOAD, DESTROY, and import.) The converse is not true.

    Therefore while you may find constructing anonymous subroutines from normal ones to be more comfortable to think through, I doubt that they are actually more flexible.