<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Don't bother with the extends stuff.&nbsp; Just <br>
</p>
<p>use MyApp::CommonUse::FileOne;</p>
<p><br>
</p>
<div id="Signature">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p><br style="font-family:'Courier New',monospace">
</p>
<p><span style="font-family:'Courier New',monospace">&nbsp;- - Martin <br>
</span></p>
<p><span style="font-family:'Courier New',monospace"><br>
</span></p>
</div>
</div>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Andrew &lt;catalystgroup@unitedgames.co.uk&gt;<br>
<b>Sent:</b> Friday, July 15, 2016 9:10 AM<br>
<b>To:</b> The elegant MVC web framework<br>
<b>Subject:</b> Re: [Catalyst] KISS - Base Subroutines.</font>
<div>&nbsp;</div>
</div>
<div>
<div><font size="2"></font>&nbsp;</div>
<div><font size="2">I'd have to look into how to do that, John.</font></div>
<div><font size="2"></font>&nbsp;</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>&nbsp;</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>&nbsp;</div>
<div><font size="2">I thought I could merely have the first file, extending Catalyst::Controller....</font></div>
<div><font size="2"></font>&nbsp;</div>
<div><font face="Courier New" size="2">BEGIN { extends 'Catalyst::Controller' }</font></div>
<div><font face="Courier New" size="2"></font>&nbsp;</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>&nbsp;</div>
<div><font face="Courier New" size="2">BEGIN { extends 'MyApp::CommonUse::FileOne' }</font></div>
<div><font face="Courier New" size="2"></font>&nbsp;</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>&nbsp;</div>
<div><font face="Courier New" size="2">BEGIN { extends 'MyApp::CommonUse::FileTwo' }</font></div>
<div><font face="Courier New" size="2"></font>&nbsp;</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">&quot;Undefined subroutine &amp;MyApp::CommonUse::FileTwo::subroutinename&quot;</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>&nbsp;</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&nbsp;FileOne, without typing the explicit package path each time?</font></div>
<div><font face="Courier New" size="2"></font>&nbsp;</div>
<div><font face="Courier New" size="2">Many thanks,</font></div>
<div><font face="Courier New" size="2"></font>&nbsp;</div>
<div><font face="Courier New" size="2">Yours,</font></div>
<div><font face="Courier New" size="2">Andrew.</font></div>
<div>&nbsp;</div>
<div><font face="Courier New" size="2"></font>&nbsp;</div>
<div>&nbsp;<br>
</div>
<br>
</div>
</div>
</div>
</body>
</html>