<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<STYLE style="DISPLAY: none" type=text/css>P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
</STYLE>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY dir=ltr bgColor=#ffffff>
<DIV><FONT size=2>I want to apologise for saying I was having trouble with 
extends.</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>When using extends,</FONT></DIV>
<DIV><FONT size=2>$self-&gt;subroutinename(); worked fine,</FONT></DIV>
<DIV><FONT size=2>while just subroutinename(); didn't - and that was my 
hiccup/mistake.</FONT></DIV>
<DIV><FONT size=2>It's now working fine with $self-&gt;subroutinename(); to call 
the subroutine, although I've obviously had to anticipate the first value of @_ 
now being $self.</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>I'm new to Modern Perl, so still a bit iffy on things like 
$self (I know it's an object - and that's it),</FONT></DIV>
<DIV><FONT size=2>so I'm intrigued to hear you mention simply using Use instead 
of extends.</FONT></DIV>
<DIV><FONT size=2>I was searching through a lot of online tutorials, and all the 
older ones have use and use base as examples in base controller 
tutorials,</FONT></DIV>
<DIV><FONT size=2>and the more recent ones mention extends instead.</FONT></DIV>
<DIV><FONT size=2>The Definitive Guide to Catalyst states: "use base 
'Catalyst::Controller' and use Moose; extends 'Catalyst Controller' are 
essentially the same,".</FONT></DIV>
<DIV><FONT size=2>I also found a Catalyst Advent Calendar post (2008, Day 
16)&nbsp;mentioning that in previous Catalysts you would use&nbsp;use, whereas 
in 5.80+ you&nbsp;could use use Moose, and then extends. I guess it's just 
another option - good to hear a plain old use could work also. KISS, 
=).</FONT><FONT size=2></FONT></DIV>
<DIV><FONT size=2></FONT><FONT size=2></FONT>&nbsp;</DIV>
<DIV><FONT size=2>Yours,</FONT></DIV>
<DIV><FONT size=2>Andrew.</FONT></DIV>
<DIV><FONT size=2></FONT>&nbsp;</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=martin.thurn@lemon.fish href="mailto:martin.thurn@lemon.fish">Martin 
  Thurn</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 2:21 PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Catalyst] KISS - Base 
  Subroutines.</DIV>
  <DIV><BR></DIV>
  <DIV id=divtagdefaultwrapper 
  style="FONT-SIZE: 12pt; COLOR: #000000; FONT-FAMILY: Calibri,Arial,Helvetica,sans-serif; BACKGROUND-COLOR: #ffffff">
  <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; FONT-FAMILY: Calibri,Arial,Helvetica,sans-serif; BACKGROUND-COLOR: #ffffff">
  <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 style="DISPLAY: inline-block; WIDTH: 98%" tabIndex=-1>

  <DIV id=divRplyFwdMsg dir=ltr><FONT style="FONT-SIZE: 11pt" 
  face="Calibri, sans-serif" color=#000000><B>From:</B> Andrew &lt;<A 
  href="mailto:catalystgroup@unitedgames.co.uk">catalystgroup@unitedgames.co.uk</A>&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>"Undefined subroutine 
  &amp;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>&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><BR>&nbsp;</DIV><BR></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>