The "FSConnector" function is available
if you have "use"d either
"Form::Sensible" or
"Form::Sensible::DelegateConnection". It
is used to easily create a
"Form::Sensible::DelegateConnection"
object in-place. You can call it two ways, first, passing a code ref:
# instead of:
my $connection = Form::Sensible::DelegateConnection->new( delegate_function => sub { ... } );
# this does the same thing:
my $connection = FSConnector( sub { ... } );
This is a modest savings in typing, but can be very convenient
when you are defining a number of delegates during form creation, for
example.
"FSConnector( ... )" is
particularly useful when linking a delegate connection to a method on an
object. This method looks like this:
my $connection = FSConnector( $object, 'method_to_call');
When used this way, The
"FSConnector" function will create a
code ref for you automatically capturing the passed object in a closure.
Again, you can do this yourself, but this makes your setup code a lot
clearer.
As a further benefit, both methods will take additional args
which will be passed to the function or method after the args passed by
the calling object:
my $connection = FSConnector( $object, 'method_to_call', 'additional','args');
This can be useful, for example, when you are using the same
object / method repeatedly, but need slightly different information in
each case.