[Catalyst] An MVC logic separation conundrum

Aristotle Pagaltzis pagaltzis at gmx.de
Thu Mar 10 12:42:21 GMT 2016


* Chris Welch <welch.chris at gmail.com> [2016-03-09 20:10]:
> All of this brings up a quandary: there are only two ways around this
> that I can see:

There’s plenty more. E.g. you could have generate_ical_data expect one
or several callbacks to generate those values for it, something like

    $match->generate_ical_data(
        get_uri         => sub { $c->uri_for_action( ... ) },
        get_description => sub { $c->maketext( ... ) },
        # ...
    );

Possibly you want to set these as instance data somewhere and then not
pass them explicitly in every call of that method, but that can easily
hurt testability and understandability of the code, so it depends on the
exact specifics of the case.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Catalyst mailing list