RE: [Catalyst] Why is $c undefined?

2012-10-30 Thread Craig Chant
Thanks Ian, The hierarchy is something that I am finding mind-blowing at the moment, $self-jqgrid-render($self, , you are calling methods jqgrid-render on $self, passing in $self, I'm sure it makes sense to you :-) One thing I would like clarification with if possible. Where do I put code

Re: [Catalyst] Why is $c undefined?

2012-10-30 Thread Ian Docherty
On 30 October 2012 11:09, Craig Chant cr...@homeloanpartnership.com wrote: Thanks Ian, The hierarchy is something that I am finding mind-blowing at the moment, $self-jqgrid-render($self, , you are calling methods jqgrid-render on $self, passing in $self, I'm sure it makes sense to you

Re: [Catalyst] Why is $c undefined?

2012-10-30 Thread Lukas Thiemeier
Hi Craig, On 10/30/2012 12:09 PM, Craig Chant wrote: Thanks Ian, The hierarchy is something that I am finding mind-blowing at the moment, $self-jqgrid-render($self, , you are calling methods jqgrid-render on $self, passing in $self, I'm sure it makes sense to you :-) No, he is

RE: [Catalyst] Unable to output anything in Root.pm - 'auto'

2012-10-30 Thread Craig Chant
What was the reason for not using DBIC again? The non-normalised DB with a missing schema and the fact the data is spread across two SQL servers on separate DSN's. I also want my data in a way I can manipulate it, maybe you are all going to fall down in shock and horror, but I get my records

Re: [Catalyst] Why is $c undefined?

2012-10-30 Thread Lukas Thiemeier
Hi Craig, You don't understand why $c-model('Model1') retrieves and data, because it doesn't retrieve any data. Database-code in the controller should be avoided, and instead be implemented in the model. My code just passes a reference to Model2 to Model1, so Model1 can access data from Model2.

[Catalyst] Global 'helper' methods

2012-10-30 Thread Craig Chant
Hi, Please could you advise the best way of having a global 'helper' class that has all commonly used methods in it accessible for any part of the catalyst app. I found this thread http://stackoverflow.com/questions/11941836/catalyst-global-subroutines With one indicating it's ok to put them

RE: [Catalyst] Global 'helper' methods

2012-10-30 Thread Craig Chant
Well I opted for putting my globals (methods and constants) in MyApp.pm It's working grand with $c-myMethod or $c-MY_CONSTANT I use to have them working as a bareword within my application , but $c-MY_CONSTANT is just as easy! Many thanks for all the input and help, it really is appreciated.

Re: [Catalyst] Global 'helper' methods

2012-10-30 Thread Lukas Thiemeier
You can also define your constants in YourApp/Constants.pl, and use YourApp::Constants wherever you need them. YourApp/Constants.pm: use constant { FOO = 1 }; 1; Controller.pm: use YourApp::Constants; # and in some method ... my $global_foo = FOO; There might be a better way, but

Re: [Catalyst] Global 'helper' methods

2012-10-30 Thread Bill Moseley
On Tue, Oct 30, 2012 at 7:03 AM, Craig Chant cr...@homeloanpartnership.comwrote: So it seems it’s OK to whack them in the main MyApp.pm , here is an example of what is currently in a ‘MemberGlobs.pm’, which is ‘required’ in 90% of all the perl scripts. Be careful with that approach. I'd

RE: [Catalyst] Global 'helper' methods

2012-10-30 Thread Craig Chant
Thanks Lukas, I appreciate there is DateTime , though I have so much legacy code that uses my helper class re-writing everything will be a mammoth task. I hand rolled a lot when I first started out with Perl, didn't know much about CPAN or PPM, and couldn't load any modules that weren't part

Re: [Catalyst] Global 'helper' methods

2012-10-30 Thread Lukas Thiemeier
Hm... how to measure the overhead of a module? There is a XS version of the module which is used if you have a C compiler. I don't know the exact overhead, but I know that it is fast. I have no experience with the pure perl version of that module. If all you have to do with the dates is the

RE: [Catalyst] Global 'helper' methods

2012-10-30 Thread Craig Chant
Hi Hugh, I assume this is for Apache and I'm running IIS7, so I guess it isn't compatible? It looks like I've been having performance problems because millions of rows get blessed into objects, not sure of this but it looks like a DBIC thing at the moment. That's not good, and is part of the

Re: [Catalyst] Global 'helper' methods

2012-10-30 Thread David Schmidt
Perhaps it is feasible for you to bypass object inflation. 1) DBIx::Class is not built for speed, it's built for convenience and ease of use, but sometimes you just need to get the data, and skip the fancy objects.

[Catalyst] Can't get view / template to work ?

2012-10-30 Thread Craig Chant
I seem stuck with implementing my first view / template. I have a controller Login.pm I ran the view helper script 'create view HTML HTML::template' As per the tutorial I've added the following to the config section of MyApp.pm TEMPLATE_EXTENSION = '.tp', 'View::HTML' = {

Re: [Catalyst] Can't get view / template to work ?

2012-10-30 Thread Rob Brown
the paths are from /root/src (as per the config), so if you've created another folder called login and put the file in there, you'd need to say... $c-stash(template = 'login/login.tp'); On 10/30/2012 04:52 PM, Craig Chant wrote: I seem stuck with implementing my first view / template. I

Re: [Catalyst] Can't get view / template to work ?

2012-10-30 Thread Len Jaffe
On Tue, Oct 30, 2012 at 12:58 PM, Rob Brown r...@intelcompute.com wrote: the paths are from /root/src (as per the config), so if you've created another folder called login and put the file in there, you'd need to say... $c-stash(template = 'login/login.tp'); Or you could add /root/src/login

Re: [Catalyst] Can't get view / template to work ?

2012-10-30 Thread Rob Brown
ignore that then, didn't read all of your message :-/ On 10/30/2012 04:58 PM, Rob Brown wrote: the paths are from /root/src (as per the config), so if you've created another folder called login and put the file in there, you'd need to say... $c-stash(template = 'login/login.tp'); On

RE: [Catalyst] Can't get view / template to work ?

2012-10-30 Thread Craig Chant
Hi Rob, As I said, I've tried that also to no avail :-( I thought the point of setting the template default extension is so you don't have to provide it? Shouldn't 'login/login' work? I can't even get the controller to work? mydomain:port/login/login just gives me a 404 not found error?

Re: [Catalyst] I'm loosing the plot here? - Controller behaviour that makes no sense

2012-10-30 Thread Lars Balker
On Tue, Oct 30, 2012 at 6:39 PM, Craig Chant cr...@homeloanpartnership.comwrote: Please advise why the following URL ‘mydomain:port/login’ Produces “Matched Members::Controller::Login in Login.” sub index :Path :Args(0) { sub loginPage :Path :Args(0) { Because having two empty

Re: [Catalyst] I'm loosing the plot here? - Controller behaviour that makes no sense

2012-10-30 Thread Tim Anderson
Craig, Might I suggest following Lukas' advice from yesterday and working through the tutorial before building your own site. Catalyst is a great framework but it's not trivial, and I had several of the same kinds of questions when I first started out. I clued in on your 'when neither output

RE: [Catalyst] I'm loosing the plot here? - Controller behaviour that makes no sense

2012-10-30 Thread Craig Chant
I've done the tutorial Debian VM walkthrough. I stopped at DBIC / CRUD, and I keep referring back to the tutorial, but it's very hard to follow when it is using examples for a templating system / ORM / CRUD and OS i'm not using. I'm also convinced there is a caching issue, how can I

RE: [Catalyst] I'm loosing the plot here? - Controller behaviour that makes no sense

2012-10-30 Thread Craig Chant
I had a hunch, so I uploaded the template to 'root' and bingo it found it so this in MyApp.pm isn't working... 'View::HTML' = { #Set the location for TT files INCLUDE_PATH = [ __PACKAGE__-path_to( 'root', 'src' ), ], } So does this attribute

Re: [Catalyst] I'm loosing the plot here? - Controller behaviour that makes no sense

2012-10-30 Thread Kieren Diment
So it doesn't really matter that you eventually don't intend to use TT, you still need a solid grounding in the core concepts which the tutorial will give you. Right now you're trying to pay attention to too many things at once. Go through the tutorial. Investment of 2-3 hours in that will

Re: [Catalyst] Unable to output anything in Root.pm - 'auto'

2012-10-30 Thread Kieren Diment
On 30/10/2012, at 11:00 PM, Craig Chant wrote: What was the reason for not using DBIC again? The non-normalised DB with a missing schema and the fact the data is spread across two SQL servers on separate DSN's. Be sure to use DBIx::Connector for connection management

Re: [Catalyst] I'm loosing the plot here? - Controller behaviour that makes no sense

2012-10-30 Thread Francisco Obispo
I have found with time that enjoying a good meal is the best debugging tool. Sent from my iPhone On Oct 30, 2012, at 1:27 PM, Craig Chant cr...@homeloanpartnership.com wrote: I had a hunch, so I uploaded the template to 'root' and bingo it found it so this in MyApp.pm isn't working...

Re: [Catalyst] Unable to output anything in Root.pm - 'auto'

2012-10-30 Thread Tomas Doran
On 30 Oct 2012, at 12:00, Craig Chant wrote: What was the reason for not using DBIC again? The non-normalised DB with a missing schema and the fact the data is spread across two SQL servers on separate DSN's. You didn't say anything there that didn't imply DBIC is fine. The reason for

Re: [Catalyst] I'm loosing the plot here? - Controller behaviour that makes no sense

2012-10-30 Thread Tomas Doran
On 30 Oct 2012, at 20:08, Craig Chant wrote: I'm also convinced there is a caching issue, how can I refresh the browser on a controller/action i've changed the response-body of and still get the old output? Please advise if there is some form of caching in Catalyst so I can turn it

Re: [Catalyst] I'm loosing the plot here? - Controller behaviour that makes no sense

2012-10-30 Thread Tomas Doran
On 30 Oct 2012, at 20:08, Craig Chant wrote: The path/controller/action is resolving correctly now, but any response-body change I make in the 'index :Path' action, isn't showing when i refresh my browser? You're not showing us the debug output of the failing request, so it's very hard

Re: [Catalyst] Global 'helper' methods

2012-10-30 Thread Tomas Doran
On 30 Oct 2012, at 14:03, Craig Chant wrote: So it seems it’s OK to whack them in the main MyApp.pm , here is an example of what is currently in a ‘MemberGlobs.pm’, which is ‘required’ in 90% of all the perl scripts. snip I’m forever having to switch between UK dates and USA dates so

Re: [Catalyst] Global 'helper' methods

2012-10-30 Thread Tomas Doran
On 30 Oct 2012, at 14:39, Craig Chant wrote: Well I opted for putting my globals (methods and constants) in MyApp.pm It's working grand with $c-myMethod or $c-MY_CONSTANT I use to have them working as a bareword within my application , but $c-MY_CONSTANT is just as easy! It's also

Re: [Catalyst] Global 'helper' methods

2012-10-30 Thread Tomas Doran
On 30 Oct 2012, at 15:03, Craig Chant wrote: Plus I always felt loading an entire module to re-arrange a tiny string seems a bit OTT? Yes, it is :) If you know that re-arranging a string is all you're ever going to be doing, then sure - don't' do that.. However, usually when you're

Re: [Catalyst] Global 'helper' methods

2012-10-30 Thread Tomas Doran
On 30 Oct 2012, at 15:47, Hugh Barnard wrote: Hi On measurement in general, I'd recommend: Devel::NYTProf::Apache ; there's a write up here: http://www.slideshare.net/bobcatfish/profiling-with-develnytprof ++ Personally, I'd not be using mod_perl if I could help it, but NYTProf is

Re: [Catalyst] Can't get view / template to work ?

2012-10-30 Thread Tomas Doran
On 30 Oct 2012, at 16:52, Craig Chant wrote: I seem stuck with implementing my first view / template. I have a controller Login.pm I ran the view helper script ‘create view HTML HTML::template’ This can't possibly have worked? You mean create view HTML HTML::Template right? As per

Re: [Catalyst] Can't get view / template to work ?

2012-10-30 Thread David Schmidt
On 31 October 2012 00:00, Tomas Doran bobtf...@bobtfish.net wrote: On 30 Oct 2012, at 16:52, Craig Chant wrote: I seem stuck with implementing my first view / template. I have a controller Login.pm I ran the view helper script ‘create view HTML HTML::template’ This can't possibly have

Re: [Catalyst] Can't get view / template to work ?

2012-10-30 Thread Tomas Doran
On 30 Oct 2012, at 23:06, David Schmidt wrote: On 31 October 2012 00:00, Tomas Doran bobtf...@bobtfish.net wrote: On 30 Oct 2012, at 16:52, Craig Chant wrote: I seem stuck with implementing my first view / template. I have a controller Login.pm I ran the view helper script ‘create