There is no performance hit for having as many helpers; however, the latter is the best solution; put all your business logic methods in a separate, reusable module, and return that module via a small helper and/or plugin.
On Fri, Jun 27, 2014 at 1:54 PM, Scott <[email protected]> wrote: > I was just curious whether there is a rule of thumb for helper method > api's. I love helpers and seem to be developing them more. In much the same > way that using @EXPORT in a normal module can pollute the global namespace, > creating numerous helper methods would seem to add a lot of methods to the > app and controller objects. Is this OK? > > I have a simple math captcha helper that has 2 > methods, create_math_captcha and validate_math_captcha. That seemed OK to > me. > > And, I have a helper based on DateTime::Tiny that could have 20 plus > methods, but I just have one, dtt (just the object instance). That also > seemed logical. > > Is there any conventions being discovered with the number of helper > methods? Is it better to do "$self->dtt" through the one helper method > "dtt" object, or does it bloat the app and c object to have numerous > $self->complete_date_time, $self->basic_date_time, etc. > > Or, do you just do what seems to makes sense. > > Thanks for any advice, > skiehn > > -- > You received this message because you are subscribed to the Google Groups > "Mojolicious" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/mojolicious. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
