html-formhandler icon indicating copy to clipboard operation
html-formhandler copied to clipboard

options method on Select fields receives inconsistent, undocumented arguments

Open karenetheridge opened this issue 9 years ago • 0 comments

I just discovered a significant behaviour difference between options methods on Select fields, depending on how they are declared:

has_field foo => (
    type => 'Select',
    options_method => sub { ... },  # receives one argument: ($field)
);

has_field bar => (
    type => 'Select',
);
sub options_bar { ... }             # receives two arguments: ($form, $field)

This causes interesting failures when moving a sub from one style to the other.

It doesn't look like the documentation describes what is passed in either case.

karenetheridge avatar Nov 02 '16 18:11 karenetheridge