<font size=2>In your example, is HelpUtils a .pm file?</font>
<br><font size=2>And if so, where in the Catalyst folder structure would
it be placed?</font>
<br><font size=2>Would I need to create a folder called Role? </font>
<br>
<br><font size=2 face="sans-serif">Yes it HelperUtils is a .pm file </font>
<br><font size=2 face="sans-serif">you can call it whatever you like</font>
<br><font size=2 face="sans-serif">in the example I gave the file will
be in you Catalyst application's(e.g MyApp) lib folder </font>
<br><font size=2 face="sans-serif">&nbsp; MyApp\lib\Role\HelpUtils.pm &nbsp;(so
yes you will need to create the Role folder)</font>
<br><font size=2 face="sans-serif">Note that this is just an example. If
you decide to name you package The::Good::Helper</font>
<br><font size=2 face="sans-serif">then the file will be MyApp\lib\The\Good\Helper.pm</font>
<br><font size=2 face="sans-serif">hope that helps<br>
<br>
<br>
<br>
Thanks<br>
<br>
Tony B. Okusanya<br>
 </font>
<br>
<br>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">From: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">&quot;Andrew&quot;
&lt;catalystgroup@unitedgames.co.uk&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">To: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">&quot;The elegant MVC
web framework&quot; &lt;catalyst@lists.scsys.co.uk&gt;, </font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">07/15/2016 08:00 AM</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject: &nbsp; &nbsp;
&nbsp; &nbsp;</font><font size=1 face="sans-serif">Re: [Catalyst]
KISS - Base Subroutines.</font>
<br>
<hr noshade>
<br>
<br>
<br><font size=2>Thanks for your suggestion, Tony, =).</font>
<br><font size=3>&nbsp;</font>
<br><font size=2>In your example, is HelpUtils a .pm file?</font>
<br><font size=2>And if so, where in the Catalyst folder structure would
it be placed?</font>
<br><font size=2>Would I need to create a folder called Role? </font>
<br><font size=3>----- Original Message ----- </font>
<br><font size=3><b>From:</b> </font><a href=mailto:anthony.okusanya@usbank.com><font size=3 color=blue><u>anthony.okusanya@usbank.com</u></font></a><font size=3>
</font>
<br><font size=3><b>To:</b> </font><a href=mailto:catalyst@lists.scsys.co.uk><font size=3 color=blue><u>The
elegant MVC web framework</u></font></a><font size=3> </font>
<br><font size=3><b>Sent:</b> Friday, July 15, 2016 12:46 AM</font>
<br><font size=3><b>Subject:</b> Re: [Catalyst] KISS - Base Subroutines.</font>
<br>
<br><tt><font size=2>Put a subroutine in a separate place, where it can
be accessed / called, by<br>
whatever controllers need to use it?</font></tt><font size=3> </font><font size=2 face="sans-serif"><br>
-------------------------------------------------------------------------------------</font><font size=3>
</font><font size=2 face="sans-serif"><br>
Why not put all your subroutines in a Role &nbsp;and consume the role in
your main application class.</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
Package Role::HelpUtils;</font><font size=3> </font><font size=2 face="sans-serif"><br>
use Moose::Role;</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
sub redirect_to_action {</font><font size=3> </font><font size=2 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;my ($c, $controller, $action, @params) =@_;</font><font size=3>
</font><font size=2 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;$c-&gt;response-&gt;redirect($c-&gt;uri_for($c-&gt;controller($controller)-&gt;action_for($action),
@params));</font><font size=3> </font><font size=2 face="sans-serif"><br>
 &nbsp; &nbsp; &nbsp; &nbsp;$c-&gt;detach;</font><font size=3> </font><font size=2 face="sans-serif"><br>
}</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
1;</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
In your main app class, simply use the role</font><font size=3> </font><font size=2 face="sans-serif"><br>
package MyApp;</font><font size=3> </font><font size=2 face="sans-serif"><br>
use Moose; <br>
use Catalyst::Runtime ;</font><font size=3> </font><font size=2 face="sans-serif"><b><br>
with 'Role::HelpUtils';</b></font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
You can then access the subroutines using &nbsp;e.g $c-&gt;redirect_to_action()</font><font size=3>
</font><font size=2 face="sans-serif"><br>
<br>
<br>
<br>
Thanks<br>
<br>
Tony B. Okusanya</font><font size=3> <br>
<br>
<br>
</font><font size=1 color=#5f5f5f face="sans-serif"><br>
From: &nbsp; &nbsp; &nbsp; &nbsp;</font><font size=1 face="sans-serif">&quot;Andrew&quot;
&lt;catalystgroup@unitedgames.co.uk&gt;</font><font size=3> </font><font size=1 color=#5f5f5f face="sans-serif"><br>
To: &nbsp; &nbsp; &nbsp; &nbsp;</font><font size=1 face="sans-serif">&quot;The
elegant MVC web framework&quot; &lt;catalyst@lists.scsys.co.uk&gt;, </font><font size=1 color=#5f5f5f face="sans-serif"><br>
Date: &nbsp; &nbsp; &nbsp; &nbsp;</font><font size=1 face="sans-serif">07/14/2016
05:59 PM</font><font size=3> </font><font size=1 color=#5f5f5f face="sans-serif"><br>
Subject: &nbsp; &nbsp; &nbsp; &nbsp;</font><font size=1 face="sans-serif">Re:
[Catalyst] KISS - Base Subroutines.</font><font size=3> <br>
</font>
<hr noshade><font size=3><br>
<br>
</font><tt><font size=2><br>
Okay, no worries, I've done it now.<br>
<br>
Created a folder called CommonUse to exist alongside Controller, View,
and<br>
Model folders, and hold perl modules that are commonly used, =).<br>
<br>
Create a file in the folder.<br>
<br>
Put my subroutine in the file.<br>
<br>
Then in the controller I want to find the subroutine, where it normally<br>
says:<br>
BEGIN { extends 'Catalyst::Controller' }<br>
...I switch it to say:<br>
BEGIN { extends 'MyApp::CommonUse::File' }<br>
....where MyApp is the name of my app, and File is the name of the perl<br>
module file I created in the CommonUse folder.<br>
Then that controller can call the subroutine, and everything seems to work,<br>
=).<br>
<br>
I read online, you could also put subrountines inside of Myapp.pm within
the<br>
lib folder, and all controllers could access it. I did try that, however,
I<br>
couldn't get it working, so any pointers on that appreciated.<br>
<br>
Yours,<br>
Andrew.<br>
<br>
<br>
<br>
----- Original Message -----<br>
From: &quot;Andrew&quot; &lt;catalystgroup@unitedgames.co.uk&gt;<br>
To: &quot;The elegant MVC web framework&quot; &lt;catalyst@lists.scsys.co.uk&gt;<br>
Sent: Thursday, July 14, 2016 9:20 PM<br>
Subject: [Catalyst] KISS - Base Subroutines.<br>
<br>
<br>
Is there a keep it simple stupid answer to the following question:<br>
<br>
Put a subroutine in a separate place, where it can be accessed / called,
by<br>
whatever controllers need to use it?<br>
<br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
List: Catalyst@lists.scsys.co.uk<br>
Listinfo: </font></tt><a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"><tt><font size=2 color=blue><u>http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</u></font></tt></a><tt><font size=2><br>
Searchable archive: </font></tt><a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/"><tt><font size=2 color=blue><u>http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</u></font></tt></a><tt><font size=2><br>
Dev site: </font></tt><a href=http://dev.catalyst.perl.org/><tt><font size=2 color=blue><u>http://dev.catalyst.perl.org/</u></font></tt></a><tt><font size=2><br>
<br>
<br>
_______________________________________________<br>
List: Catalyst@lists.scsys.co.uk<br>
Listinfo: </font></tt><a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"><tt><font size=2 color=blue><u>http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</u></font></tt></a><tt><font size=2><br>
Searchable archive: </font></tt><a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/"><tt><font size=2 color=blue><u>http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</u></font></tt></a><tt><font size=2><br>
Dev site: </font></tt><a href=http://dev.catalyst.perl.org/><tt><font size=2 color=blue><u>http://dev.catalyst.perl.org/</u></font></tt></a><font size=3><br>
<br>
<br>
<br>
U.S. BANCORP made the following annotations<br>
---------------------------------------------------------------------</font><font size=3 face="Arial"><br>
Electronic Privacy Notice. This e-mail, and any attachments, contains information
that is, or may be, covered by electronic communications privacy laws,
and is also confidential and proprietary in nature. If you are not the
intended recipient, please be advised that you are legally prohibited from
retaining, using, copying, distributing, or otherwise disclosing this information
in any manner. Instead, please reply to the sender that you have received
this communication in error, and then immediately delete it. Thank you
in advance for your cooperation.</font><font size=3><br>
<br>
--------------------------------------------------------------------- </font>
<p>
<hr>
<p><font size=3>_______________________________________________<br>
List: Catalyst@lists.scsys.co.uk<br>
Listinfo: </font><a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"><font size=3>http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</font></a><font size=3><br>
Searchable archive: </font><a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/"><font size=3>http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</font></a><font size=3><br>
Dev site: </font><a href=http://dev.catalyst.perl.org/><font size=3>http://dev.catalyst.perl.org/</font></a><tt><font size=2>_______________________________________________<br>
List: Catalyst@lists.scsys.co.uk<br>
Listinfo: </font></tt><a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"><tt><font size=2>http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</font></tt></a><tt><font size=2><br>
Searchable archive: </font></tt><a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/"><tt><font size=2>http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</font></tt></a><tt><font size=2><br>
Dev site: </font></tt><a href=http://dev.catalyst.perl.org/><tt><font size=2>http://dev.catalyst.perl.org/</font></tt></a><tt><font size=2><br>
</font></tt>
<p><br><br>
U.S. BANCORP made the following annotations<br>---------------------------------------------------------------------<br>

<span style="font-family: Arial;" size="2;">Electronic Privacy Notice. This e-mail, and any attachments, contains information that is, or may be, covered by electronic communications privacy laws, and is also confidential and proprietary in nature. If you are not the intended recipient, please be advised that you are legally prohibited from retaining, using, copying, distributing, or otherwise disclosing this information in any manner. Instead, please reply to the sender that you have received this communication in error, and then immediately delete it. Thank you in advance for your cooperation.</span><br>
<br>
---------------------------------------------------------------------