[Catalyst] KISS - Base Subroutines.
Andrew
catalystgroup at unitedgames.co.uk
Thu Jul 14 22:52:39 GMT 2016
Okay, no worries, I've done it now.
Created a folder called CommonUse to exist alongside Controller, View, and
Model folders, and hold perl modules that are commonly used, =).
Create a file in the folder.
Put my subroutine in the file.
Then in the controller I want to find the subroutine, where it normally
says:
BEGIN { extends 'Catalyst::Controller' }
...I switch it to say:
BEGIN { extends 'MyApp::CommonUse::File' }
....where MyApp is the name of my app, and File is the name of the perl
module file I created in the CommonUse folder.
Then that controller can call the subroutine, and everything seems to work,
=).
I read online, you could also put subrountines inside of Myapp.pm within the
lib folder, and all controllers could access it. I did try that, however, I
couldn't get it working, so any pointers on that appreciated.
Yours,
Andrew.
----- Original Message -----
From: "Andrew" <catalystgroup at unitedgames.co.uk>
To: "The elegant MVC web framework" <catalyst at lists.scsys.co.uk>
Sent: Thursday, July 14, 2016 9:20 PM
Subject: [Catalyst] KISS - Base Subroutines.
Is there a keep it simple stupid answer to the following question:
Put a subroutine in a separate place, where it can be accessed / called, by
whatever controllers need to use it?
_______________________________________________
List: Catalyst at 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/
More information about the Catalyst
mailing list