[html-formfu] RFC: new constraint: Eval

Carl Franks fireartist at gmail.com
Sat Jan 17 11:21:41 GMT 2009


2009/1/16 Markus Holzer <markus.holzer at dmk-internet.com>:
> Hi @ll.
>
> As the Callback constraint is somewhat limited, I hacked together this
> constraint which comes in useful when you need more power. Of course, as
> always when eval is involved: Don't trust your user input! So either add
> additional constraints or activate paranoia mode by setting "safe" to 1.
>
> thoughts?

I'm not terribly keen, to be honest.
In any application, I usually have a handful of custom constraints
sitting in the application's lib/ directory - and I think that's the
proper place for perl code, not a config file.

If you really don't want to create custom constraints, you can simply
create a new package file, with a new subroutine for each constraint,
and add a Callback constraint, pointing to that package/subroutine:
    type: Callback
    callback: MyConstraints::get_url

Both your examples though, can already be done with the Callback constraint.
    type: Callback
    callback: Core::cos

    type: Callback
    callback: LWP::Simple::get
(as long as you have code somewhere that does `use LWP::Simple`)

Carl



More information about the HTML-FormFu mailing list