Menu

Adding a Function

Hugh Barnard

We're doing this to add a 'liquidity' (helicopter money) function at the moment, so this page gives a rough idea of how to extend Cclite2.

  1. (Please) Do a little analysis of whether the function is really new!
  2. Design a template, preferably English language, because the other templates are machine translated from English. This will go into /usr/share/templates/<type>/<language-code>. Have a look and borrow from existing templates.
  3. Add a route in /usr/share/cclite2/lib/Cclite2.pm, again look at existing routes, Mojolicious documentation and borrow.
  4. Add code to the main controller/usr/share/cclite2/lib/Cclite2/Cclite2.pm, almost certainly this passes off control to, for example Ccadmin.pm (if it's an admin function) or another module. Clearly, create a module if, as and when necessary.
  5. Add a test or two in the test directory /usr/share/Cclite2/t/take a look at the existing tests for inspiration.

If it's something really interesting or useful, contact us and we'll put it into the core code.