[Catalyst] KISS - Base Subroutines.

Martin Thurn martin.thurn at lemon.fish
Fri Jul 15 13:21:38 GMT 2016


Don't bother with the extends stuff.  Just

use MyApp::CommonUse::FileOne;



 - - Martin



________________________________
From: Andrew <catalystgroup at 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.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/catalyst/attachments/20160715/4a1a1810/attachment.htm>


More information about the Catalyst mailing list