Don't bother with the extends stuff.  Just

use MyApp::CommonUse::FileOne;



 - - Martin



________________________________
From: Andrew <catalystgr...@unitedgames.co.uk>
Sent: Friday, July 15, 2016 9:10 AM
To: The elegant MVC web framework
Subject: Re: [Catalyst] KISS - Base Subroutines.


I'd have to look into how to do that, John.

Right now, I've got something working, so I'll continue to build on that.

One problem I have come across with my approach of a CommonUse folder, and .pm 
files within it,
is when one of the .pm files needs to be used by another.

I thought I could merely have the first file, extending Catalyst::Controller....

BEGIN { extends 'Catalyst::Controller' }

....and the second file, extending the first file:

BEGIN { extends 'MyApp::CommonUse::FileOne' }

...and then the controller that needs to use FileTwo, extending that...

BEGIN { extends 'MyApp::CommonUse::FileTwo' }

Unfortunately, when FileTwo tries to call a subroutine in FileOne, I get:
"Undefined subroutine &MyApp::CommonUse::FileTwo::subroutinename"
If I stop worrying about the BEGIN/extends block, and instead just type: 
MyApp::CommonUse::FileOne::subroutinename(); it executes fine.

In short:
I've a base controller directory called CommonUse.
There are two files in it.
How can FileTwo use subroutines in FileOne, without typing the explicit package 
path each time?

Many thanks,

Yours,
Andrew.




_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to