<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 5.50.4807.2300" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I'd have to look into how to do that, John.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Right now, I've got something working, so I'll continue to
build on that.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>One problem I have come across with my approach of a CommonUse
folder, and .pm files within it,</FONT></DIV>
<DIV><FONT size=2>is when one of the .pm files needs to be used by
another.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I thought I could merely have the first file, extending
Catalyst::Controller....</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>BEGIN { extends 'Catalyst::Controller'
}</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>....and the second file, extending the
first file:</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>BEGIN { extends 'MyApp::CommonUse::FileOne'
}</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>...and then the controller that needs to
use FileTwo, extending that...</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>BEGIN { extends 'MyApp::CommonUse::FileTwo'
}</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Unfortunately, when FileTwo tries to call a
subroutine in FileOne, I get:</FONT></DIV>
<DIV><FONT face="Courier New" size=2>"Undefined subroutine
&MyApp::CommonUse::FileTwo::subroutinename"</FONT></DIV>
<DIV><FONT face="Courier New" size=2>If I stop worrying about the BEGIN/extends
block, and instead just type: MyApp::CommonUse::FileOne::subroutinename(); it
executes fine. </FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>In short:</FONT></DIV>
<DIV><FONT face="Courier New" size=2>I've a base controller directory called
CommonUse.</FONT></DIV>
<DIV><FONT face="Courier New" size=2>There are two files in it.</FONT></DIV>
<DIV><FONT face="Courier New" size=2>How can FileTwo use subroutines
in FileOne, without typing the explicit package path each
time?</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Many thanks,</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Yours,</FONT></DIV>
<DIV><FONT face="Courier New" size=2>Andrew.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=jjn1056@yahoo.com href="mailto:jjn1056@yahoo.com">John
Napiorkowski</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=catalyst@lists.scsys.co.uk
href="mailto:catalyst@lists.scsys.co.uk">The elegant MVC web framework</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, July 15, 2016 1:57 AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Catalyst] KISS - Base
Subroutines.</DIV>
<DIV><FONT size=2></FONT><FONT size=2></FONT><BR></DIV>
<DIV
style="FONT-SIZE: 16px; COLOR: #000; FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; BACKGROUND-COLOR: #fff">
<DIV><SPAN>I'd consider a Role or maybe a Util package with 'Exporter'
depending on what the shared function is intended to do -jnap</SPAN></DIV>
<DIV class=qtdSeparateBR><FONT face=Arial size=2></FONT><FONT face=Arial
size=2></FONT><BR><BR></DIV>
<DIV class=yahoo_quoted style="DISPLAY: block">
<DIV
style="FONT-SIZE: 16px; FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif">
<DIV
style="FONT-SIZE: 16px; FONT-FAMILY: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif">
<DIV dir=ltr><FONT face=Arial size=2>On Thursday, July 14, 2016 6:47 PM, "<A
href="mailto:anthony.okusanya@usbank.com">anthony.okusanya@usbank.com</A>"
<<A
href="mailto:anthony.okusanya@usbank.com">anthony.okusanya@usbank.com</A>>
wrote:<BR></FONT></DIV><BR><BR>
<DIV class=y_msg_container>
<DIV id=yiv9392018278>
<DIV><TT><FONT size=2>Put a subroutine in a separate place, where it can be
accessed / called, by<BR clear=none>whatever controllers need to use
it?</FONT></TT> <BR clear=none><FONT face=sans-serif
size=2>-------------------------------------------------------------------------------------</FONT>
<BR clear=none><FONT face=sans-serif size=2>Why not put all your subroutines
in a Role and consume the role in your main application class.</FONT>
<BR clear=none><BR clear=none><FONT face=sans-serif size=2>Package
Role::HelpUtils;</FONT> <BR clear=none><FONT face=sans-serif size=2>use
Moose::Role;</FONT> <BR clear=none><BR clear=none><FONT face=sans-serif
size=2>sub redirect_to_action {</FONT> <BR clear=none><FONT face=sans-serif
size=2> my ($c, $controller, $action, @params)
=@_;</FONT> <BR clear=none><FONT face=sans-serif size=2>
$c->response->redirect($c->uri_for($c->controller($controller)->action_for($action),
@params));</FONT> <BR clear=none><FONT face=sans-serif size=2>
$c->detach;</FONT> <BR clear=none><FONT face=sans-serif
size=2>}</FONT> <BR clear=none><BR clear=none><FONT face=sans-serif
size=2>1;</FONT> <BR clear=none><BR clear=none><FONT face=sans-serif size=2>In
your main app class, simply use the role</FONT> <BR clear=none><FONT
face=sans-serif size=2>package MyApp;</FONT> <BR clear=none><FONT
face=sans-serif size=2>use Moose; </FONT><BR clear=none><FONT face=sans-serif
size=2>use Catalyst::Runtime ;</FONT> <BR clear=none><FONT face=sans-serif
size=2><B>with 'Role::HelpUtils';</B></FONT> <BR clear=none><BR
clear=none><FONT face=sans-serif size=2>You can then access the subroutines
using e.g $c->redirect_to_action()</FONT> <BR clear=none><FONT
face=sans-serif size=2><BR clear=none><BR clear=none><BR clear=none>Thanks<BR
clear=none><BR clear=none>Tony B. Okusanya</FONT> <BR clear=none><BR
clear=none><BR clear=none>
<DIV class=yiv9392018278yqt9504350784 id=yiv9392018278yqtfd46723><FONT
face=Arial size=2></FONT><FONT face=Arial size=2></FONT><BR clear=none><FONT
face=sans-serif color=#5f5f5f size=1>From:
</FONT><FONT face=sans-serif size=1>"Andrew"
<catalystgroup@unitedgames.co.uk></FONT> <BR clear=none><FONT
face=sans-serif color=#5f5f5f size=1>To:
</FONT><FONT face=sans-serif size=1>"The elegant MVC web framework"
<catalyst@lists.scsys.co.uk>, </FONT><BR clear=none><FONT
face=sans-serif color=#5f5f5f size=1>Date:
</FONT><FONT face=sans-serif size=1>07/14/2016 05:59 PM</FONT> <BR
clear=none><FONT face=sans-serif color=#5f5f5f size=1>Subject:
</FONT><FONT face=sans-serif size=1>Re: [Catalyst] KISS - Base
Subroutines.</FONT> <BR clear=none>
<HR noShade>
<BR clear=none><BR clear=none><BR clear=none><TT><FONT size=2>Okay, no
worries, I've done it now.<BR clear=none><BR clear=none>Created a folder
called CommonUse to exist alongside Controller, View, and<BR clear=none>Model
folders, and hold perl modules that are commonly used, =).<BR clear=none><BR
clear=none>Create a file in the folder.<BR clear=none><BR clear=none>Put my
subroutine in the file.<BR clear=none><BR clear=none>Then in the controller I
want to find the subroutine, where it normally<BR clear=none>says:<BR
clear=none>BEGIN { extends 'Catalyst::Controller' }<BR clear=none>...I switch
it to say:<BR clear=none>BEGIN { extends 'MyApp::CommonUse::File' }<BR
clear=none>....where MyApp is the name of my app, and File is the name of the
perl<BR clear=none>module file I created in the CommonUse folder.<BR
clear=none>Then that controller can call the subroutine, and everything seems
to work,<BR clear=none>=).<BR clear=none><BR clear=none>I read online, you
could also put subrountines inside of Myapp.pm within the<BR clear=none>lib
folder, and all controllers could access it. I did try that, however, I<BR
clear=none>couldn't get it working, so any pointers on that appreciated.<BR
clear=none><BR clear=none>Yours,<BR clear=none>Andrew.<BR clear=none><BR
clear=none><BR clear=none><BR clear=none>----- Original Message -----<BR
clear=none>From: "Andrew" <catalystgroup@unitedgames.co.uk><BR
clear=none>To: "The elegant MVC web framework"
<catalyst@lists.scsys.co.uk><BR clear=none>Sent: Thursday, July 14, 2016
9:20 PM<BR clear=none>Subject: [Catalyst] KISS - Base Subroutines.<BR
clear=none><BR clear=none><BR clear=none>Is there a keep it simple stupid
answer to the following question:<BR clear=none><BR clear=none>Put a
subroutine in a separate place, where it can be accessed / called, by<BR
clear=none>whatever controllers need to use it?<BR clear=none><BR
clear=none><BR clear=none><BR clear=none><BR clear=none><BR clear=none><BR
clear=none>_______________________________________________<BR clear=none>List:
Catalyst@lists.scsys.co.uk<BR clear=none>Listinfo: </FONT></TT><A
target=_blank
href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst" rel=nofollow
shape="rect"><TT><FONT
size=2>http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</FONT></TT></A><TT><FONT
size=2><BR clear=none>Searchable archive: </FONT></TT><A target=_blank
href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/" rel=nofollow
shape="rect"><TT><FONT
size=2>http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</FONT></TT></A><TT><FONT
size=2><BR clear=none>Dev site: </FONT></TT><A target=_blank
href="http://dev.catalyst.perl.org/" rel=nofollow shape="rect"><TT><FONT
size=2>http://dev.catalyst.perl.org/</FONT></TT></A><TT><FONT size=2><BR
clear=none><BR clear=none><BR
clear=none>_______________________________________________<BR clear=none>List:
Catalyst@lists.scsys.co.uk<BR clear=none>Listinfo: </FONT></TT><A
target=_blank
href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst" rel=nofollow
shape="rect"><TT><FONT
size=2>http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</FONT></TT></A><TT><FONT
size=2><BR clear=none>Searchable archive: </FONT></TT><A target=_blank
href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/" rel=nofollow
shape="rect"><TT><FONT
size=2>http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</FONT></TT></A><TT><FONT
size=2><BR clear=none>Dev site: </FONT></TT><A target=_blank
href="http://dev.catalyst.perl.org/" rel=nofollow shape="rect"><TT><FONT
size=2>http://dev.catalyst.perl.org/</FONT></TT></A></DIV><TT><FONT size=2><BR
clear=none></FONT></TT><BR clear=none><BR clear=none><BR clear=none>U.S.
BANCORP made the following annotations<BR
clear=none>---------------------------------------------------------------------<BR
clear=none><SPAN style="FONT-FAMILY: Arial">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>
<DIV class=yiv9392018278yqt9504350784 id=yiv9392018278yqtfd21029><BR
clear=none><BR
clear=none>---------------------------------------------------------------------</DIV></DIV></DIV><BR>
<DIV class=yqt9504350784
id=yqtfd04102>_______________________________________________<BR
clear=none>List: <A href="mailto:Catalyst@lists.scsys.co.uk" shape="rect"
ymailto="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</A><BR
clear=none>Listinfo: <A target=_blank
href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst"
shape="rect">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</A><BR
clear=none>Searchable archive: <A target=_blank
href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/"
shape="rect">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</A><BR
clear=none>Dev site: <A target=_blank href="http://dev.catalyst.perl.org/"
shape="rect">http://dev.catalyst.perl.org/</A><BR
clear=none></DIV><BR><BR></DIV></DIV></DIV></DIV></DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>List:
Catalyst@lists.scsys.co.uk<BR>Listinfo:
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst<BR>Searchable
archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/<BR>Dev site:
http://dev.catalyst.perl.org/<BR></BLOCKQUOTE></BODY></HTML>