[Catalyst] more description for FAST CGI deployment in catalyst cookbook?
hi guys i am trying to figure out how to bring my app for production. Looked at http://search.cpan.org/dist/Catalyst-Manual/lib/Catalyst/Manual/Cookbook.pod#FastCGI_Deployment and i am just wondering if anyone can add more description for FAST CGI deployment in catalyst cookbook? For example, there's a bunch of configuration in step 2 of FAST CGI deployment (title of 2. Configure your application). The problem I am having here is that there is no mention of WHERE should the configuration should be put in. K.akimoto ___ 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/
[Catalyst] nginx configuration tute for catalyst
hi, all i am looking at http://dev.catalyst.perl.org/wiki/adventcalendararticles/2008/02-catalyst_and_nginx. First of all, let me apologise as i dont have a sent folder in this lite mail client of mine. Hence, i cannot post this question to my previously sent mail. i am looking at http://dev.catalyst.perl.org/wiki/adventcalendararticles/2008/02-catalyst_and_nginx. Under the following, which file do we put the fastcgi_pass unix:/var/www/MyApp/fastcgi.socket; in ? Nginx Configuration Configuring a location in nginx to be handled by FastCGI is trivial. It's a simple one-liner, nestled into a location block, which points out the location to the socket: ___ 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/
Re: [Catalyst] Switching to a production server
hello. Emily, how is your catalyst app now? Is it running smoothly with FastCGI? thanks K. akimoto Re: [Catalyst] Switching to a production server ivorw Tue, 16 Sep 2008 12:53:47 -0700 Emily Heureux wrote: Thanks, I read your suggestions and opinions and am switching to fastcgi with apache. I'd like to do this in steps: 1. Install FCGI::ProcManager 2. Run myapp_fastcgi.pl from the command line, just like myapp_server.pl 3. Then go through apache with mod_fastcgi. I am on step 2, and I am thinking that I can't do that with that fastcgi script like I can with myapp_server.pl. I need to combine 2 and 3? E I would do 3 before 2. Configure Apache to be ready to handle a fastcgi connection through a socket (from the docs): FastCgiExternalServer /tmp/myapp.fcgi -socket /tmp/myapp.socket Alias /myapp/ /tmp/myapp/myapp.fcgi/ # Or, run at the root Alias / /tmp/myapp.fcgi/ # Optionally, rewrite the path when accessed without a trailing slash RewriteRule ^/myapp$ myapp/ [R] Now having reloaded or restarted Apache2, you should be in a position to point a browser at the new application, and get a 500 error page. The logs should be able to tell you whether your Apache configuration is doing the right thing. ___ 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/
Re: [Catalyst] more description for FAST CGI deployment in catalyst cookbook?
Hello Kieren 1) I was just asking where do I put the configuration as per the article. Here's an extract from my prev email. For example, there's a bunch of configuration in step 2 of FAST CGI deployment (title of 2. Configure your application). The problem I am having here is that there is no mention of WHERE should the configuration should be put in. 2) No, I m not in sydney but yes, i am going to look into placing an order through Amazon. Can you suggest a faster way (aside Sydney.pm) to get a copy ? PDF purchase maybe? You need to show us explicitly what you have tried so far for anyone to be able to point out the error of your ways. At the risk of seeming facetious, I suggest that you obtain the new Catalyst book (http://www.amazon.com/gp/product/1430223650 disclaimer: I am the primary author), read chapter 5 on deployment, and once you understand that you can patch the documentation for the benefit of others. This is how I got started writing docs for Catalyst, because I was frustrated that the instructions were not easy and obvious to me, and I needed something I knew I could follow. The book follows the same principle, which is why about a third of it is written by other people. Firstly it means I can safely forget what I already know and look it up instead, and secondly I can stand on the shoulders of people who are taller than me :) and look up what they have to say as well. If you're close to Sydney, Sydney.pm will be having a book launch (where there is a chance of winning a copy), probably on Tuesday the 28th of July. I'll be sure to announce it on this list. ___ 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/
Re: [Catalyst] nginx configuration tute for catalyst
Hi, J :) Good morning. Thanks for that piece of info. I wish someone would just patch the documentation as that single line does help a non-nginx/admin savvy person trying to set up nginx. K. akimoto On Wed, Jul 15th, 2009 at 10:50 PM, Jason Galea li...@eightdegrees.com.au wrote: Hi K, that'd be your nginx.conf. You should find it in /etc/nginx/ or maybe /usr/local/nginx all depending on how nginx was installed. cheers, J ___ 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/
Re: [Catalyst] more description for FAST CGI deployment in catalyst cookbook?
Yep, i can agree with that. I do hope someone could write a tute for a specific setup. At least there's something concrete for non-admin savvy people to turn to. thanks On Thu, Jul 16th, 2009 at 9:34 AM, Andrew Rodland arodl...@comcast.net wrote: On Wednesday 15 July 2009 06:23:24 pm kakim...@tpg.com.au wrote: Again, my question is, where do I put the configuration above in? apache.conf ? httpd.conf? Doesn't say :( Wherever it needs to be for your setup; apache configurations differ quite a bit by vendor, and this is the Catalyst cookbook, not the Apache instructions. 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/
Re: [Catalyst] Hangs in RenderView in end
hello, t0m, Good morning. 1)Does using the Prefork engine work, or does it exhibit the same behavior? I am sorry as I can't tell you. This is because I have not tried it yet. Been developing and noticed this strange problem. I m pretty stuck halfway now with a Catalyst application that works fine sometimes on firefox MAC Os X but works fine always on any non-firefox 3.5 on mac os X. Good news is that the windows people running IE, Safari and FF would be able to use the application without a problem whilst us Mac folks using Firefox 3/3.5 will not be able to (and also hang my server) :( 2) I have tried this on Mac OS X Leopard and Tiger (both running Firefox 3/3.5) . Problem comes up sometimes only. This is very sporadic because I tried the replicate the problem at another interval and Firefox was able to handle it. Tried it the next hour or evening and it jams up. Then, after restarted the catalyst application process, I use safari to perform the same tasks and no problems are observed. 3) Here is an extract of the strace. Thank you :) accept(5, {sa_family=AF_INET, sin_port=htons(50067), sin_addr=inet_addr(123.243.50.59)}, [10647353952623919120]) = 6 ioctl(6, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff4c95dea0) = -1 EINVAL (Invalid argument) lseek(6, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) ioctl(6, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff4c95dea0) = -1 EINVAL (Invalid argument) lseek(6, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) fcntl(6, F_SETFD, FD_CLOEXEC) = 0 fcntl(6, F_GETFL) = 0x2 (flags O_RDWR)read(6, GET / HTTP/1.1\r\nHost: www.myApp..., 65536) = 514 getpeername(6, {sa_family=AF_INET, sin_port=htons(50067), sin_addr=inet_addr(123.243.50.59)}, [6788732235563401232]) = 0getsockname(6, {sa_family=AF_INET, sin_port=htons(3000), sin_addr=inet_addr(125.214.64.65)}, [6788732235563401232]) = 0 open(/etc/hosts, O_RDONLY|0x8 /* O_??? */) = 9fcntl(9, F_GETFD) = 0 fcntl(9, F_SETFD, FD_CLOEXEC) = 0 fstat(9, {st_mode=S_IFREG|0644, st_size=170, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2b0f67b6b000read(9, 127.0.0.1 localhost.localdomain ..., 4096) = 170 close(9)= 0 munmap(0x2b0f67b6b000, 4096)= 0 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0rt_sigaction(SIGCHLD, {SIG_DFL}, {SIG_IGN}, 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0rt_sigaction(SIGCHLD, {SIG_DFL}, {SIG_DFL}, 8) = 0rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 stat(/etc/localtime, {st_mode=S_IFREG|0644, st_size=2183, ...}) = 0fcntl(6, F_GETFL) = 0x2 (flags O_RDWR) fcntl(6, F_SETFL, O_RDWR|O_NONBLOCK)= 0 alarm(10) = 0 fcntl(3, F_SETLKW, {type=F_WRLCK, whence=SEEK_SET, start=3932160, len=65536}) = 0 alarm(0)= 10 fcntl(3, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=3932160, len=65536}) = 0 alarm(10) = 0 fcntl(3, F_SETLKW, {type=F_WRLCK, whence=SEEK_SET, start=2359296, len=65536}) = 0alarm(0) = 10 fcntl(3, F_SETLKW, {type=F_UNLCK, whence=SEEK_SET, start=2359296, len=65536}) = 0stat(/home/kakimoto/projects/myApp/root/src/index.tt2, {st_mode=S_IFREG|0755, st_size=248, ...}) = 0stat(/home/kakimoto/projects/myApp/root/src/config/main, 0x70fcc0) = -1 ENOENT (No such file or directory)stat(/home/kakimoto/projects/myApp/root/lib/config/main, {st_mode=S_IFREG|0755, st_size=803, ...}) = 0 stat(/home/kakimoto/projects/myApp/root/src/config/col, 0x70fcc0) = -1 ENOENT (No such file or directory) stat(/home/kakimoto/projects/myApp/root/lib/config/col, {st_mode=S_IFREG|0755, st_size=449, ...}) = 0 stat(/home/kakimoto/projects/myApp/root/src/config/url, 0x70fcc0) = -1 ENOENT (No such file or direc tory) stat(/home/kakimoto/projects/myApp/root/lib/config/url, {st_mode=S_IFREG|0755, st_size=139, ...}) = 0 stat(/home/kakimoto/projects/myApp/root/src/menu.tt2, {st_mode=S_IFREG|0755, st_size=502, ...}) = 0 write(8, SELECT me.id, me.password, me.fi..., 276) = 276 rt_sigprocmask(SIG_BLOCK, [PIPE], [], 8) = 0 sendto(7, B\0\0\0!\0dbdpg_p18331_2\0\0\0\0\1\0\0\0\0013\0\1..., 56, 0, NULL, 0) = 56rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 poll([{fd=7, events=POLLIN|POLLERR, revents=POLLIN}], 1, -1) = 1 recvfrom(7, 2\0\0\0\4T\0\0\1\320\0\20id\0\0\0cN\0\1\0\0\0\27\0\4\377..., 16384, 0, NULL, NULL) = 745 stat(/home/kakimoto/projects/myApp/root/src/listings/search.tt2, {st_mode=S_IFREG|0755, st_size=1861 , ...}) = 0 open(/home/kakimoto/projects/myApp/root/src/listings/search.tt2, O_RDONLY) = 9 ioctl(9, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff4c95ecf0) = -1 ENOTTY (Inappropriate ioctl for device) lseek(9, 0, SEEK_CUR) = 0 fstat(9, {st_mode=S_IFREG|0755, st_size=1861, ...}) = 0 fcntl(9, F_SETFD, FD_CLOEXEC) = 0fstat(9, {st_mode=S_IFREG|0755, st_size
Re: [Catalyst] more description for FAST CGI deployment in catalyst cookbook?
What OS/Distro are you using? Maybe someone else already has an example/setup that you can peek at. Good morning, Chisel. Yep, I am using Ubuntu Hardy Heron :) That would be most helpful. Thanks :) -- Chisel Wright ___ 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/
Re: [Catalyst] nginx configuration tute for catalyst
-- Yep, I would love to but as I don't know how to set up NgiNx myself for catalyst, I can't :( On 16 Jul 2009, at 00:20, kakim...@tpg.com.au wrote: I wish someone would just patch the documentation as that single line does help a non-nginx/admin savvy person trying to set up nginx. So why don't you? Cheers t0m ___ 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/
Re: [Catalyst] Custom error handling
hello Tomas, thank you. I will look into fine tuning it in the future. Will read more. K. akimoto But throwing strings around is however a perfectly valid technique. ___ 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/
Re: [Catalyst] how to implement Transactions (over different db tables) in a Catalyst project
hello there, Tomas, Thank you :) Yes, you're quite right there:) Prior to receiving this reply, I actually wrapped my existing code in the subroutine within an sub for the txn_do. sub save_complete_records { ... eval { $c-model('myAppDB')-schema-txn_do( sub { ... $c-forward( '/subscriptions/_save_address', [ { 'policy_id' = $policy_id, } ] ); ... } if ($@) { $c-log-debug(' Exception manually trapped here : ' . $@ ); $c-model('myAppDB')-schema-txn_rollback or die Cannot ROLL BACK - Address module; $c-log-debug(' manually rolled back' ); $c-error( q{ An error has occured with the listing. If this problem } . q{persists please contact our helpdesk at helpd...@insuranceline.}. q{com.nz.} ); } } To test, I purposedly entered a very long string for one of the database attributes to make the transaction fail. I have the following questions: 1) I looked at the terminal with all the debug messages. I noticed that the exception was caught and eventhough the roll back was done, I do not see the print outs from the liens within the if ($@) (exception handling) section above. Why is that? 2) I noticed that whilst the rollback was successful. the sequence do not get rolled back. IS this desired behaviour of DBIx::Class? To illustrate, before the exception was caught, an entry was made in my User_Subscriptions database table. The ID was printed out and I took note of it. When the operation was complete, I queried my User_Subscriptions database table (using psql for postgresql for an entry of the noted ID). No entry of the noted ID was returned. I went back to the webpage and entered the form with valid attributes and yes, all necessary objects were created in the database backend and the sequence in the User_Subscriptions database table had increased by 1. Any ideas, Tomas and everyone? :) thank you :) k. akimoto On Mon, Jul 6th, 2009 at 6:18 PM, Tomas Doran bobtf...@bobtfish.net wrote: This is fairly easy to get wrong - txn_do forces you to have a block which comprises the transaction scope, or your code won't compile. It will start a transaction at the start of the block, and commit it at the end if an exception hasn't been encountered during the transaction ___ 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/
Re: [Catalyst] how to implement Transactions (over different db tables) in a Catalyst project
hi Tomas and everyone:) I still have some questions as per my prev post. Can you please help me out? :) I have the following questions: 1) I looked at the terminal with all the debug messages. I noticed that the exception was caught and eventhough the roll back was done, I do not see the print outs from the liens within the if ($@) (exception handling) section above. Why is that? 2) I noticed that whilst the rollback was successful. the sequence do not get rolled back. IS this desired behaviour of DBIx::Class? To illustrate, before the exception was caught, an entry was made in my User_Subscriptions database table. The ID was printed out and I took note of it. When the operation was complete, I queried my User_Subscriptions database table (using psql for postgresql for an entry of the noted ID). No entry of the noted ID was returned. I went back to the webpage and entered the form with valid attributes and yes, all necessary objects were created in the database backend and the sequence in the User_Subscriptions database table had increased by 1. .snip. And I'm crap. You need $c-model('myAppDB')-schema-txn_do( sub { Cheers ___ 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/
Re: [Catalyst] how to implement Transactions (over different db tables) in a Catalyst project
So, in the case of an exception, an automatic rollback will take place. I have tested this in my application and it seems that way. Can anyone confirm this? Thank you:) This is fairly easy to get wrong - txn_do forces you to have a block which comprises the transaction scope, or your code won't compile. It will start a transaction at the start of the block, and commit it at the end if an exception hasn't been encountered during the transaction ___ 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/
Re: [Catalyst] how to implement Transactions (over different db tables) in a Catalyst project
Did you look what the code does? http://cpansearch.perl.org/src/RIBASUSHI/DBIx-Class-0.08107/lib/DBIx/Class/Storage.pm and http://cpansearch.perl.org/src/RIBASUSHI/DBIx-Class-0.08107/t/81transactions.t If the API doc is written well, I suppose one doens't need to look at the source code (unless forced to). I must admit that I didn't fallback to looking at the regression test. I will do so next time:) See sub txn_do. It begins a transaction, runs your coderef inside an eval, rolls back the transaction if the eval raises an exception. Yes I did but at that point in time, the documentation on txn_do wasn't that clear. I think someone must have updated it since this question was raised. However, this is NOT a Catalyst question. Please subscribe to the DBIx::Class users list at: http://lists.scsys.co.uk/mailman/listinfo/dbix-class/ and ask these questions there. Many of the subscribers are the same, but many Catalyst users don't use DBIx::Class, and many knowledgeable DBIC users are not subscribed here. It's just good hygiene to ask the questions in the appropriate places. there's somethign wrong with the mailing list for Dbix::Class as I have not been able to get replies /mails. I have contacted the admin in the past and never got any reply. I will retry. Nevertheless, given that Dbix::Class is of the choice for catalyst, I figured the grey area here may see my questions lucky enough to have some replies from the many who use Dbix::Class for their Catalyst apps. ___ 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/
Re: [Catalyst] how to implement Transactions (over different db tables) in a Catalyst project
Did you even look for this in the manual? http://search.cpan.org/~ribasushi/DBIx-Class-0.08107/lib/DBIx/Class/ Storage.pm#txn_do If not, why not. If so, how is this not clear? Well, it's really clear now . I suppose someone has updated the documentation since I posted this thread up. ___ 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/
Re: [Catalyst] how to implement Transactions (over different db tables) in a Catalyst project
On Tue, Jul 7th, 2009 at 8:54 AM, J. Shirley jshir...@gmail.com wrote: On Mon, Jul 6, 2009 at 3:36 PM, kakim...@tpg.com.au wrote: there's somethign wrong with the mailing list for Dbix::Class as I have not been able to get replies /mails. I have contacted the admin in the past and never got any reply. I will retry. Sorry if it caused any inconvenience , guys:( Considering the same people/software/servers run both the DBIC list and the Catalyst list, I'm going to assume you're both lazy and inept. Doubly so for re-asking the question immediately on the Catalyst list. You are not entitled to get free help just because you can compose an email. $B$$J$?$OBU$1T!#(B ___ 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/
[Catalyst] Parse errors: Tests out of sequence - any ideas?
hello, everyone, I jsut tried to run my regression tests to see if things were ok or not. I found that they fail due to Parse errors: Tests out of sequence. I took one of the regression test files and stripped down the tests to about 5 basic tests. Ran prove -v t/regression test file.t and still fails with this message: ok 4 - Successfully loaded sign_up page 1..4 Failed 1/4 subtests Test Summary Report --- t/controller_Agents.t (Wstat: 0 Tests: 3 Failed: 0) Parse errors: Tests out of sequence. Found (2) but expected (1) Tests out of sequence. Found (3) but expected (2) Tests out of sequence. Found (4) but expected (3) Bad plan. You planned 4 tests but ran 3. I tried searching on google but I just don't know what's causing this. Any ideas would be welcomed. Thank you K. akimoto ___ 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/
Re: [Catalyst] Custom error handling
hello Tomas and everyone, Thank you for that. I got it working. What I also did was the in the case of an exception, I will redirect the user back to the main page with the error shown. I would like to share what I did. On Root.pm-end: I passed the error message to the flash (I have flash_to_stash turned on) because due to a redirection, the only way the error message can be sustained is via the flash. sub end : ActionClass('RenderView') { my ($self, $c) = @_; if ( scalar @{ $c-error } ) { $c-flash-{errors} = $c-error; $c-response-redirect($c-uri_for('/')); $c-error(0); } return 1; }; On my controller, Subscriptions.pm === sub _save_address : Private { eval { . }; if ($@) { $c-error (' A problem occurred when saving your address. Please try again later' ); } } Using die(' A problem occurred when saving your address. Please try again later' );, I would get an error message such as Exception caught in myApp::Controller::Subscription-_save_address which doesn't look so good to the users. that's why I used $c-error. Please tell me if it's bad practice? thank you, everybody for your time! :) K. akimoto On Mon, Jul 6th, 2009 at 12:22 AM, Tomas Doran bobtf...@bobtfish.net wrote: On 5 Jul 2009, at 05:32, kakim...@tpg.com.au wrote: Any idea of how to get a custom screen up? You're not clearing the errors, so Catalyst gives you an error screen: http://search.cpan.org/~flora/Catalyst-Runtime-5.80007/lib/ Catalyst.pm#$c-%3Eclear_errors Cheers t0m ___ 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/ ___ 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/
[Catalyst] how to implement Transactions (over different db tables) in a Catalyst project
hi , everyone, i m trying to put transactions in place for my catalyst project. For example, I would like to create a new user subscription. What this does is, - create two new Address objects (Address db table) where one's for billing address and another for main contact. - create a new User Subscriptions object (and link the two new Address objects by IDs into attributes, billing_address_id and main_contact_address_id). What I have refered to: http://search.cpan.org/~ribasushi/DBIx-Class-0.08107/lib/DBIx/Class/Manual/Cookbook.pod http://kobesearch.cpan.org/htdocs/DBIx-Class/DBIx/Class/Storage.html#txn_do http://kobesearch.cpan.org/htdocs/DBIx-Class/DBIx/Class/Storage.html#txn_begin http://kobesearch.cpan.org/htdocs/DBIx-Class/DBIx/Class/Storage.html#txn_commit http://search.cpan.org/~ribasushi/DBIx-Class-0.08107/lib/DBIx/Class/Storage.pm In the past, when I had to work with just DBI, I would manually start a transaction and commit it at the end if no exceptions occur. In the case of the latter, I will call a rollback. How do I do it here in Catalyst/DbiX::Class land? I tried to read up the http://kobesearch.cpan.org/htdocs/DBIx-Class/DBIx/Class/Storage.html#txn_do doc but I can't see how the example can apply to Catalyst. It says, $schema-txn_do($coderef) to get the schema but in catalyst, we access the database tables directly. For example, my $rs = $c-model('myAppDB::UserSusbcriptions')-search( .. ); I'm a bit confused and have looked in a few places. Can anyone please educate me? thank you:) K.akimoto ___ 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/
Re: [Catalyst] Custom error handling
hello, Tomas, thank you :) My replies are as per below. You mean you're calling $c-error yourself in your own controller code? Yes I am. You haven't shown us the code you're putting stuff into $c-error with, therefore it's pretty hard to tell how you're doing it wrong. Extract from Controller (Start) sub _save_address { }; if ($@) { $c-log-debug('Exception while saving address - '. $@); $c-error( q{ An error has occured with the address entered. Please ensure } . q{that you have entered a valid address. If this persists, } . q{please contact our helpdesk at helpd...@loadproperty.com.au.} ); } return $address-id; } Extract from Controller (End) Try just putting: die(An error) into your controller code, and you should see that captured in $c- error when it gets to your end action yes, when i did that in my controller code, this is what I saw on the terminal's logs: [error] Caught exception in myApp::Controller::Listings-_save_address An error at /home/kakimoto/projects/myApp/script/../lib/myApp/Controller/Listings.pm line 590. When I remove -Debug from myApp.pm, I get just the generic screen saying Please come back later whilst when I have -Debug there in myApp.pm, I get a screen with the following message in the web browser. Caught exception in myApp::Controller::Listings-_save_address An error at /home/kakimoto/projects/myApp/script/../lib/myApp/Controller/Listings.pm line 590. My Root-end now looks like this: sub end : ActionClass('RenderView') { my ($self, $c) = @_; $c-log-debug( Calling END in Root #. Data::Dumper-Dump([$c-error]) ); if ( scalar @{ $c-error } ) { $c-log-debug(' Found an error in Root' ); $c-stash-{errors} = $c-error; $c-stash-{template} = 'menu.tt'; } else { $c-log-debug( nothing done ); } return 1; } In the terminal logs, I do get the message, Found an error in Root BUT it doesn't load the template i specified (menu.tt2). Any idea of how to get a custom screen up? ___ 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/
[Catalyst] Custom error handling
hi ,guys, referring to http://search.cpan.org/~hkclark/Catalyst-Manual-5.8000/lib/Catalyst/Manual/Cookbook.pod#Delivering_a_Custom_Error_Page, i can't seem to see the error page when I have my Root.pm's sub end set up this way. sub end : ActionClass('RenderView') { my ($self, $c) = @_; $c-log-debug( Calling END in Root ); if ( scalar @{ $c-error } ) { $c-stash-{errors} = $c-error; $c-stash-{template} = 'menu.tt'; $c-error(0); } else { $c-log-debug( nothign done ); } } I can see that a $c-error () is being called in one of my controllers and the Room-end has been called (thanks to my debugging messages above) BUT the $c-error doesn't seem to be detected in the Room-end that I have. Instead, i see nothign done being printed out. Any ideas , fellas? thank you:) K. akimoto ___ 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/
Re: [Catalyst] can't seem to install local::lib in dreamhost
this looks good. I will give it a go soon. Thank you! If you just need Catalyst on Dreamhost I managed to install it following these instructions http://wiki.dreamhost.com/Catalyst have a nice day, arjuna ___ 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/
[Catalyst] Is there a good solution of file cache? which plugin is recommended?
Hi, there, I looked at the example in the doc for Catalyst::Plugin::PageCache (http://search.cpan.org/~agrundma/Catalyst-Plugin-PageCache-0.21/lib/Catalyst/Plugin/PageCache.pm). I m not very clear on it. 1) Can someone please tell me where sub some_method is supposed to reside? Is it in the controller? Can't be cause there's a section commented # in a controller method 2) Has anyone used Catalyst::Plugin::PageCache? Any complaints or words of praise? Thank you:) K. akimoto - Re: [Catalyst] Is there a good solution of file cache? which plugin is recommended? Matt S Trout Thu, 30 Apr 2009 15:45:40 -0700 On Thu, Apr 30, 2009 at 11:46:12PM +0800, Malloy wrote: Vague question is vague. Perhaps you could try asking a question with some detail about what you're going to be caching, why you want to do so, and why you think a Catalyst plugin is the right layer of your stack to do this? ___ 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/
[Catalyst] anyone used Varnish yet?
hi everyone, I just read http://www.catalystframework.org/calendar/2008/14 I have seen some mentions on http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg04620.html and http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg06552.html . Was wondering if anyone's used it and have any words of praise/complaints? thanks k. akimoto ___ 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/
Re: [Catalyst] can't seem to install local::lib in dreamhost
If all you tell us about is that you did it wrong, you're just going to be told to do it right. You can avoid this by actually telling us everything you did in your first email: the same error came up denying me access to run make install. Here's how my installation looked like. Thanks for helping:) - ExtUtils::MakeMaker ...missing. (would need 6.31) - ExtUtils::CBuilder ...loaded. (0.18) - ExtUtils::ParseXS ...loaded. (2.15) - ex ...missing. (would need 0.28) - CPAN...missing. (would need 1.80) [apocalypse]$ ./Build install --install_base /home/anexiole/projects/lib CPAN-1.94/distroprefs/MSERGEANT.AxKit.yml CPAN-1.94/distroprefs/AUDREYT.Module-Signature.yml [snip] CPAN-1.94/distroprefs/RRWO.Graphics-ColorNames.yml CPAN-1.94/distroprefs/JSHIRLEY.Catalyst-Action-REST.yml CPAN-1.94/distroprefs/KNORR.Net-MirrorDir.yml ^CN-1.94/t/12cpan.t Uncompressed /home/anexiole/.cpan/sources/authors/id/A/AN/ANDK/CPAN-1.94.tar.gz successfully Using Tar:/bin/tar xvf /home/anexiole/.cpan/sources/authors/id/A/AN/ANDK/CPAN-1.94.tar: ^CCouldn't untar /home/anexiole/.cpan/sources/authors/id/A/AN/ANDK/CPAN-1.94.tar ^C^C [apocalypse]$ [apocalypse]$ [apocalypse]$ [apocalypse]$ pwd /home/anexiole/manual_installs/local-lib-1.001000 [apocalypse]$ [apocalypse]$ perl Makefile.PL --bootstrap [apocalypse]$ setscreen -bash: setscreen: command not found [apocalypse]$ screen # '/usr/bin/perl -Mblib -MSimple -we print Simple::version() # ' # doesn't match '(?-xism:0.01$)' Can't load '/tmp/MB-Nr3bn2Ct/Simple/blib/arch/auto/Simple/Simple.so' for module Simple: /tmp/MB-Nr3bn2Ct/Simple/blib/arch/auto/Simple/Simple.so: failed to map segment from shared object: Operation not permitted at /usr/lib/perl/5.8/DynaLoader.pm line 225. at -e line 0 Compilation failed in require. BEGIN failed--compilation aborted. t/xs..NOK 7 # Failed test in t/xs.t at line 62. # '/usr/bin/perl -Mblib -MSimple -we print Simple::xs_version() # ' # doesn't match '(?-xism:0.01$)' t/xs..ok 10/23Can't load '/tmp/MB-Nr3bn2Ct/Simple/blib/arch/auto/Simple/Simple.so' for module Simple: /tmp/MB-Nr3bn2Ct/Simple/blib/arch/auto/Simple/Simple.so: failed to map segment from shared object: Operation not permitted at /usr/lib/perl/5.8/DynaLoader.pm line 225. at t/basic.t line 4 Compilation failed in require at t/basic.t line 4. BEGIN failed--compilation aborted at t/basic.t line 4. # Looks like your test died before it could output anything. t/xs..NOK 11 # Failed test in t/xs.t at line 83. # got: 'Failed 1/1 test scripts, 0.00% okay. 2/2 subtests failed, 0.00% okay. # ' # expected: '' Can't load '/tmp/MB-Nr3bn2Ct/Simple-With-Deep-Name/blib/arch/auto/Simple/With/Deep/Name/Name.so' for module Simple::With::Deep::Name: /tmp/MB-Nr3bn2Ct/Simple-With-Deep-Name/blib/arch/auto/Simple/With/Deep/Name/Name.so: failed to map segment from shared object: Operation not permitted at /usr/lib/perl/5.8/DynaLoader.pm line 225. at t/basic.t line 4 Compilation failed in require at t/basic.t line 4. BEGIN failed--compilation aborted at t/basic.t line 4. # Looks like your test died before it could output anything. Format STDOUT_TOP redefined at (eval 105) line 1. Format STDOUT redefined at (eval 106) line 1. Failed 1/1 test scripts, 0.00% okay. 2/2 subtests failed, 0.00% okay. # Looks like you planned 23 tests but only ran 17. # Looks like you failed 5 tests of 17 run. # Looks like your test died just after 17. t/xs..dubious Test returned status 255 (wstat 65280, 0xff00) DIED. FAILED tests 4-7, 11, 18-23 Failed 11/23 tests, 52.17% okay Failed Test Stat Wstat Total Fail Failed List of Failed --- t/compat.t 1 256 1311 0.76% 113 t/xs.t 255 6528023 17 73.91% 4-7 11 18-23 3 tests and 12 subtests skipped. Failed 2/30 test scripts, 93.33% okay. 12/1022 subtests failed, 98.83% okay. EWILHELM/Module-Build-0.33.tar.gz ./Build test -- NOT OK //hint// to see the cpan-testers results for installing this module, try: reports EWILHELM/Module-Build-0.33.tar.gz Running Build install make test had returned bad status, won't install without force *** Module::Build installation failed. *** Module::AutoInstall installation finished. Checking if your kit is complete... Looks good Warning: prerequisite ExtUtils::MakeMaker 6.31 not found. We have 6.3001. Warning: prerequisite Module::Build 0.28 not found. We have 0.26. 'INSTALL_BASE' is not a known MakeMaker parameter name. Writing Makefile for local::lib mak [apocalypse]$ make test PERL_DL_NONLAZY=1 /usr/bin/perl -MExtUtils::Command::MM -e test_harness(0, 'inc', 'blib/lib', 'blib/arch') t/classmethod.t t/pipeline.t t/classmethod.t .. 1/? Name File::Spec::rel2abs used only once: possible typo at t/classmethod.t line 20. Attempting to create directory t/var/splat Attempting
[Catalyst] can't seem to install local::lib in dreamhost
hi guys I refered to http://www.catalystframework.org/calendar/2007/8 to install local::lib into my dreamhost account. I downloaded the tar file for local-lib and extracted it to a place in my home dir. In changed into the directory that local-lib contents lived in. I ran perl Makefile.PL --bootstrap PREFIX=/home/kakimoto -- went OK I ran make test -- went OK I ran make install and this is the error I got: [apocalypse]$ make install mkdir /usr/local/lib/perl: Permission denied at /usr/share/perl/5.8/ExtUtils/Install.pm line 112 make: *** [pure_site_install] Error 13 [apocalypse]$ HEL!! ___ 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/
Re: [Catalyst] can't seem to install local::lib in dreamhost
Yes, I actually tried doing it without PREFIX but it still didn;t work. Then I thought that since I installed perl modules into my home directory, maybe that's using the PREFIX would do the trick. hdp.perl.catalyst.us...@weftsoar.net On Tue, Jun 23, 2009 at 01:33:01PM +1000, kakim...@tpg.com.au wrote: I ran perl Makefile.PL --bootstrap PREFIX=/home/kakimoto -- went OK Nothing in the documentation for local::lib OR the calendar entry you linked to says to use a PREFIX= parameter here. ___ 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/
Re: [Catalyst] Re: OT: Better TT pager?
helllo, there, Fernan and everyone :) good morning! this may change depending on your configuration of the TT view. In my case it's not 'c' but 'Catalyst', as in [% Catalyst.req.uri_with() -%] yes, i know that we can either use [% c %] or [% Catalyst %]. My actual question is that why are we using the request object in the view ? Anyway , sorted it out. All good. thank you:) ___ 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/
Re: [Catalyst] Re: OT: Better TT pager?
Hi, there, Oliver and everyone:) Thanks for your posting:) Referring to http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg05232.html, I adopted the code given into my template and it looks really good but the hyperlink doesn't have any value. I suppose it's because [% c.req.uri_with(...) %] is not defined. 1)why is the Catalyst request variable being used instead of the Catalyst object? 2)how can we get the Catalyst request working properly (ie to be defined)? thank you :) K . akimoto - Oliver Charles Thu, 22 Jan 2009 07:50:17 -0800 I might as well join in with this :) Here's what we use at work: [% IF pager %] ul class=paginator li class=counterPage [% pager.current_page %] of [% pager.last_page %]/li lia href=[% c.req.uri_with( page = pager.first_page ) %]laquo;/a/li [% IF pager.previous_page %] lia href=[% c.req.uri_with( page = pager.previous_page ) %]lt;/a/li [% END %] [% start = (pager.current_page - 3) 0 ? (pager.current_page - 3) : 1; FOREACH page IN [ start .. pager.last_page ] %] [% LAST IF loop.count 6 %] li[% IF pager.current_page == page; ' class=current'; END %] a href=[% c.req.uri_with( page = page ) %][% page %]/a /li [% END %] [% IF pager.next_page %] lia href=[% c.req.uri_with( page = pager.next_page ) %]gt;/a/li [% END %] lia href=[% c.req.uri_with( page = pager.last_page ) %]raquo;/a/li /ul [% END %] Though my colleague rightly suggested we subclass Data::Page and perform the sliding window in there. This shows first page, previous page, the current page surrounded by near-by pages. Seems to do the job so far! ___ 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/
Re: [Catalyst] Notes on installing lighttpd and FastCGI for Catalyst
Sorry, I'm just too excited in having to solve the problem. Have been googling without much success hence the impatient postings. Thanks for your response in relation to the matter. I will look at it soon! thanks :) K. akimoto:) You only waited 1 day. Reposting the entire message after such a short period is usually seen as bad behaviour. ___ 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/
Re: [Catalyst] Notes on installing lighttpd and FastCGI for Catalyst
hello Ash, I looked through my config files again and have been successful in running /etc/init.d/lighttpd with no errors in /var/log/lighttpd/error.log. Based on the tutorial in http://dev.catalyst.perl.org/wiki/deployment/lighttpd_fastcgi, can anyone please tell me what are the urls for the set up of prod and staging environments? thank you ___ 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/
[Catalyst] Notes on installing lighttpd and FastCGI for Catalyst
hi guys, I'm facing some problems with http://dev.catalyst.perl.org/wiki/deployment/lighttpd_fastcgi. I followed the instructions and still can't get to anyone of my sites listed below. - www.myapp.com/ (production) - www.myapp.com:59000/ (production) - www.stage.myapp.com:59000/ (staging) 1) I still have the default /etc/lighttpd/lighttpd.conf existing. Is that going to cause confusion? 2) Since the tute instructed us to make the /etc/lighttpd/conf-available/20_stage.conf and /etc/lighttpd/conf-available/20_prod.conf, should I start lighttpd with: - lighttpd -f /etc/lighttpd/conf-available/20_stage.conf - lighttpd -f /etc/lighttpd/conf-available/20_prod.conf If that's the case, I reckon I should put in more config into the two files mentioned (such as with document root and so forth) I;m not very good with admin/setup of services, so guys, I would appreaciate some input:) thank you K. akimoto ___ 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/ ___ 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/
Re: [Catalyst] Notes on installing lighttpd and FastCGI for Catalyst
Well, I'm facing an issue with setting up lighthttpd for production use of my catalyst app. I'm a developer so any setup task dealing with systems does cause problems. I observed another thread pretty similar to this but there's no reply to whether it's been solved or not. http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg00146.html On Sat, Jun 6th, 2009 at 8:16 PM, Andrew Rodland arodl...@comcast.net wrote: On Saturday 06 June 2009 04:04:08 am kakim...@tpg.com.au wrote: hi guys, I'm facing some problems with http://dev.catalyst.perl.org/wiki/deployment/lighttpd_fastcgi. This message looks oddly familiar. 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/
Re: [Catalyst] Notes on installing lighttpd and FastCGI for Catalyst
hi guys, I'm facing some problems with http://dev.catalyst.perl.org/wiki/deployment/lighttpd_fastcgi. I followed the instructions and still can't get to anyone of my sites listed below. - www.myapp.com/ (production) - www.myapp.com:59000/ (production) - www.stage.myapp.com:59000/ (staging) 1) I still have the default /etc/lighttpd/lighttpd.conf existing. Is that going to cause confusion? 2) Since the tute instructed us to make the /etc/lighttpd/conf-available/20_stage.conf and /etc/lighttpd/conf-available/20_prod.conf, should I start lighttpd with: - lighttpd -f /etc/lighttpd/conf-available/20_stage.conf - lighttpd -f /etc/lighttpd/conf-available/20_prod.conf If that's the case, I reckon I should put in more config into the two files mentioned (such as with document root and so forth) I;m not very good with admin/setup of services, so guys, I would appreaciate some input:) thank you K. akimoto ___ 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/
[Catalyst] Re: How to use self made Template Toolkit plugins?
hi there, how do I access the Catalyst variable in a custom made Template Toolkit plugin? WhaT I have done: read up on http://search.cpan.org/src/MRAMBERG/Catalyst-View-TT-0.27/lib/Catalyst/View/TT.pm For example, I have my own plugin, package myApp::View::Template::Plugin::User use strict; use warnings; use base 'Template::Plugin'; use Template::Plugin; use DateTime; use DateTime::Format::Pg; sub load { my ( $class, $context ) = @_; return $class; } sub new { my ( $class, $context, @params ) = @_; bless { _CONTEXT = $context, }, $class; # returns blessed MyPlugin object } sub get_current_user { my ($class, $c) = @_; $c-log-debug( The type is . ref ($c)); return $c-session-{'active_user'} ? $c-session-{'active_user'} : $c-user-login_id; } === And in my template toolkit, display_user.tt2 I do something like: [% current_user = User.get_current_user(Catalyst) %] THE current user is ([% current_user %]) I noticed that myApp::View::Template::Plugin::User-get_current_user doesn't print out any values. I suspect it has not even been able to recognise the Catalyst variable. I even tried doing [% current_user = User.get_current_user( $Catalyst ) %] in the display_user.tt2 template file. Please help :) K. akimoto ___ 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/
Re: [Catalyst] Installing Catalyst::Authentication::Store::DBIx::Class Breaks Catalyst
Hello, Collin, My modules are: | Catalyst::Plugin::Authentication 0.10011 | | Catalyst::Plugin::Authentication::Credential::Password | | Catalyst::Plugin::Authorization::Roles 0.07 | What are you using? Mine's still not working . Even downloaded the codes for tute 6 (http://search.cpan.org/~hkclark/Catalyst-Manual-5.7021/lib/Catalyst/Manual/Tutorial/Authorization.pod) and it still doesn't work... Weird.. Will work on it more today and will revert K. akimoto Quoting Collin Condray ccond...@gmail.com: It looks like the problem is resolved. I upgraded to the latest version of Catalyst and Authentication/Authorization started working normally. Funny how that happens. Thanks for the follow up. I appreciate it! Collin Condray condray.net On Tue, May 12, 2009 at 7:28 AM, kakim...@tpg.com.au wrote: Hello, Collin I have the same configuration and output of the Catalyst config too! My problem is a bit different. I could login but the accounts that have 'admin' roles would never get detected of the 'admin' role. How are you doing with this issue? Guys, please comment. Thank you:) K. akimoto Quoting Collin Condray ccond...@gmail.com: Tomas, Here's the config section of the debug output: do { my $a = { Action::RenderView = { ignore_classes = [ DBIx::Class::ResultSource::Table, DBIx::Class::ResultSourceHandle, DateTime, ], scrubber_func = sub { ??? }, }, Plugin::Authentication = { default_realm = dbic, realms = { dbic = { credential = { class = Password, password_field = password, password_hash_type = SHA-1, password_type = hashed, }, store = { class = DBIx::Class, ignore_fields_in_find = [], role_field = role, role_relation = roles, store_user_class = Catalyst::Authentication::Store::DBIx::Class::User, user_class = myappDB::Users, }, use_session = 1, }, }, use_session = 1, }, Plugin::ConfigLoader = {}, authentication = 'fix', custom-error-messsage = { error-template = internal_error.tt, view-name = TToolkit }, email = [Sendmail], home = /home/.avis/username/domainname.com/myapp, name = myapp, require_ssl = { no_cache = 0, remain_in_ssl = 1 }, root = bless({ dirs = [ , home, .avis, username, domainname.com, myapp, root, ], file_spec_class = undef, ___ 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/
Re: [Catalyst] Installing Catalyst::Authentication::Store::DBIx::Class Breaks Catalyst
Hello, all, What I did: 1) Downloaded a copy of the tute codes for http://search.cpan.org/~hkclark/Catalyst-Manual-5.7021/lib/Catalyst/Manual/Tutorial/Authorization.pod 1.5) Works Very well! :D 2) Modified MyApp.pm and Schema/Users.pm, Schema/UserRoles.pm and Schema/Roles.pm to reflect my database model. This is what my MyApp.pm has for plugins: # Load plugins use Catalyst qw/-Debug ConfigLoader Static::Simple StackTrace Authentication Authentication::Credential::Password Authorization::Roles Session Session::Store::FastMmap Session::State::Cookie /; 3) Ran application ( DBIC_TRACE=1 perl script/myapp_server.pl ). I did see the sql that queries the Users database table (which is expected) but no other sqls that query the UserRoles and/or Roles database table. Any idea why? 4) Can log in (authentication is OK) but can't user object can't show the roles of the current user. In my MyApp::Controller::Login.pm, I have the following: if ($c-authenticate ( {'username' = $username, 'password'= $password} )) { ## If successful, then let them use the application if ($c-check_user_roles( admin )) { $c-log-debug( Admin TRACKED ); } else{ $c-log-debug( Admin NOT TRACKED ); } ... } I keep seeing Admin NOT TRACKED implying that the user object is not finding the roles. As my application runs on a database backend, I don't think it's going to be possible for me to include it in this post. I am really suspecting that Roles Authorization (with a database backend using Catalyst::Authentication::Store::DBIx::Class ) doesn't work at all or is broken. Question: 1) Anyone else having problems with using Roles Authorization (with a database backend using Catalyst::Authentication::Store::DBIx::Class )? 2) Any up-to-date documentation to illustrate on roles Authorization set up using a database backend available? I am very sorry to trouble you guys but I am really wanting to use the Authorization plugins in Catalyst (to keep everything in my application in the theme of Catalyst) , but after many hours , reading and trying different methods to debug, I can't seem to get it working Please help:) Thank you. K. akimoto Quoting kakim...@tpg.com.au: Hello, Collin, My modules are: | Catalyst::Plugin::Authentication 0.10011 | | Catalyst::Plugin::Authentication::Credential::Password | | Catalyst::Plugin::Authorization::Roles 0.07 | \ ___ 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/
Re: [Catalyst] Installing Catalyst::Authentication::Store::DBIx::Class Breaks Catalyst
hello, guys, I have taken a copy of the tute codes which work for authrozation. 1) Created the required db tables in postgresql (made a new database) 2) Changed my lib/MyApp/Model/DB.pm to point to the new database I made 3) populated all the required values. 4) restarted the application 5) Managed to log in but an error message comes up on the web interface: Couldn't render template undef error - role table does not have a column called role at /home/kakimoto/projects/esca/MyApp/root/src/books/list.tt2 line 50 This is really weird. I am using the same model files as per the tute (no changes at all) . Here's an extract of how my db looks like using pg_dump. I have also attached a file here. --Extract End-- -- -- Name: roles; Type: TABLE; Schema: public; Owner: myapp_user; Tablespace: -- CREATE TABLE roles ( id integer NOT NULL, role text ); -- -- Name: user_roles; Type: TABLE; Schema: public; Owner: myapp_user; Tablespace: -- CREATE TABLE user_roles ( user_id integer NOT NULL, role_id integer NOT NULL ); CREATE TABLE users ( id integer NOT NULL, username text, password text, email_address text, first_name text, last_name text, active integer ); --Extract End-- Could it be that there's some definition I never declare such that Catalyst::Authentication::Store::DBIx::Class would know which is the actual Roles db table to look at? ___ 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/
Re: [Catalyst] Need some help with Authorization setup
Hmm, hard to tell from just looking at the code. It'd probably be easier if you made a TestApp which just contains the code in question (i.e. small enough section to demonstrate your issue) and stuck a .tgz somewhere online (or uploaded the app to github).. Then someone could download and run your actual code with problems, making it a lot easier / quicker for someone to help out and spot what is wrong. Cheers t0m Good morning, Tom. Yep I will strip down my app and do this. Thank you and have a good day :) K. akimoto ___ 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/
Re: [Catalyst] Need some help with Authorization setup
hi, guys, I have looked at my codes again. I read a lot more and debugged a lot more. I have arrived at the point whereby my catalyst user object doesn't have any value for roles (despite all the values have been set in the database backend). What am I missing? For example, running the code which dumps a list of roles as per http://search.cpan.org/~hkclark/Catalyst-Manual-5.7021/lib/Catalyst/Manual/Tutorial/Authorization.pod#___top (title of Add Role-Specific Logic to the Book List Template) doesn't show anything but by right, my current user has an 'admin' role. What am I missing out? Please help. My apologies for the many files here. Thank you and help!! :) File Extract: lib/myApp.pm == use Catalyst qw( -Debug ConfigLoader Static::Simple StackTrace Authentication Authentication::Credential::Password Authorization::Roles Cache Cache::Store::FastMmap FormValidator Session Session::Store::FastMmap Session::State::Cookie ); __PACKAGE__-config( 'name'= 'myApp', 'session' = { 'flash_to_stash' = 1 }, 'static' = { 'include_path' = [ $static_dir{'base'}, $static_dir{'user_media'}, ], }, 'Plugin::Authentication' = { default_realm = 'members', members = { credential = { class= 'Password', password_field = 'password', password_type= 'hashed', 'password_hash_type' = 'SHA-384', }, store = { class = 'DBIx::Class', user_model= 'myAppDB::Users', role_relation = 'map_user_role', role_field= 'role', }, }, }, 'default_view' = 'myApp::View::TT', ); File Extract: ~/projects/myApp/lib/myApp/Schema/Roles.pm package myApp::Schema::Roles; use strict; use warnings; use base 'DBIx::Class'; __PACKAGE__-load_components qw( TimeStamp Core ); __PACKAGE__-table(roles); __PACKAGE__-add_columns( id, { data_type = integer, default_value = nextval('roles_id_seq'::regclass), is_nullable = 0, size = 4, }, role, { data_type = text, default_value = undef, is_nullable = 1, size = undef, }, ); __PACKAGE__-set_primary_key(id); __PACKAGE__-add_unique_constraint(roles_pkey, [id]); # Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-04-16 15:08:18 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7hanYe3kgzC1BJKgsYhH3g __PACKAGE__-has_many( 'map_user_role' = 'myApp::Schema::UserRoles', 'role_id'); 1; File Extract: ~/projects/myApp/lib/myApp/Schema/Users.pm use base 'DBIx::Class'; __PACKAGE__-load_components qw( TimeStamp Core ); __PACKAGE__-table(users); __PACKAGE__-add_columns( id, { data_type = integer, default_value = nextval('users_id_seq'::regclass), is_nullable = 0, size = 4, }, password, { data_type = text, default_value = undef, is_nullable = 0, size = undef, }, first_name, { data_type = text, default_value = undef, is_nullable = 1, size = undef, }, last_name, { data_type = text, default_value = undef, is_nullable = 1, size = undef, }, active, { data_type = integer, default_value = undef, is_nullable = 1, size = 4 }, main_contact_id, { data_type = integer, default_value = undef, is_nullable = 1, size = 4 }, company_name, { data_type = text, default_value = undef, is_nullable = 1, size = undef, }, billing_details_id, { data_type = integer, default_value = undef, is_nullable = 1, size = 4 }, billing_address_id, { data_type = integer, default_value = undef, is_nullable = 1, size = 4 }, created_by, { data_type = character varying, default_value = undef, is_nullable = 1, size = 12, },
Re: [Catalyst] Need some help with Authorization setup
hello, Kieren, Good evening. Thank you and I shall get on it. K. akimoto Quoting Kieren Diment dim...@gmail.com: Try prodding around your code with the debugger. http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial::Debugging ___ 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/
Re: [Catalyst] Need some help with Authorization setup
Quoting Kieren Diment dim...@gmail.com: Try prodding around your code with the debugger. Yep and done that. I could login without a problem just that the 'roles' never get populated. Any ideas to debug? The docs are fine, and I think roles support should work out of the box, but use the http credential, as it's easier to get up. 1) Nah, not using http credentials. The requirement/design for my app is to have user credentials stored in the database tables, users, user_roles and roles. 2) There's way too many docs available for Authorization and some vagueness about the effectiveness of the documentation. - headed to the docs for Catalyst::Plugin::Authorization::Roles - it doesn't describe the module, its purpose and so forth in good depth of detail - There's another reference link in that documentation that points to http://catalyst.perl.org/calendar/2005/24 - Headed over there and found that the article is obsolete. Been told to go to http://dev.catalyst.perl.org/wiki/gettingstarted/howtos/interim_authorization_and_authentication_example instead. - Headed over there and then it says that The new Authentication tutorial is now available on CPAN. Please use that instead of the example below. - Headed over to the Catalyst tute, did whatever's needed there and yet I still have this issue of the roles not getting into the catalyst user object. 1) clearly, there's too many redirections - I hope someone can just delete the material that's no longer relevant (ie deprecated) 2) I need some help, guys as the catalyst tute for authorization doesn't work for me. I am using postgresql database as a backend. I seem to find that Put the following in Controller::Root: sub auto : Private { my ($self, $c) = @_; $c-authenticate; } and then have a poke around with TT and with the debugger to see what's missing or wrong in your setup. may i ask how so? I'm in Login-index and I could authenticate just fine. I have tried dumping out the value of $c-user-roles and it's got nothing. Hel!! ___ 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/
Re: [Catalyst] Installing Catalyst::Authentication::Store::DBIx::Class Breaks Catalyst
Hello, Collin I have the same configuration and output of the Catalyst config too! My problem is a bit different. I could login but the accounts that have 'admin' roles would never get detected of the 'admin' role. How are you doing with this issue? Guys, please comment. Thank you:) K. akimoto Quoting Collin Condray ccond...@gmail.com: Tomas, Here's the config section of the debug output: do { my $a = { Action::RenderView = { ignore_classes = [ DBIx::Class::ResultSource::Table, DBIx::Class::ResultSourceHandle, DateTime, ], scrubber_func = sub { ??? }, }, Plugin::Authentication = { default_realm = dbic, realms = { dbic = { credential = { class = Password, password_field = password, password_hash_type = SHA-1, password_type = hashed, }, store = { class = DBIx::Class, ignore_fields_in_find = [], role_field = role, role_relation = roles, store_user_class = Catalyst::Authentication::Store::DBIx::Class::User, user_class = myappDB::Users, }, use_session = 1, }, }, use_session = 1, }, Plugin::ConfigLoader = {}, authentication = 'fix', custom-error-messsage = { error-template = internal_error.tt, view-name = TToolkit }, email = [Sendmail], home = /home/.avis/username/domainname.com/myapp, name = myapp, require_ssl = { no_cache = 0, remain_in_ssl = 1 }, root = bless({ dirs = [ , home, .avis, username, domainname.com, myapp, root, ], file_spec_class = undef, ___ 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/
[Catalyst] Need some help with Authorization setup
hi, guys, I got some concerns about the Autorization modules for Catalyst. What I have checked: 1) Looked at the tutes for Authentication and Authorization: http://search.cpan.org/~hkclark/Catalyst-Manual-5.7021/lib/Catalyst/Manual/Tutorial/Authentication.pod http://search.cpan.org/~hkclark/Catalyst-Manual-5.7021/lib/Catalyst/Manual/Tutorial/Authorization.pod 2) looked at the cookbook: http://search.cpan.org/~hkclark/Catalyst-Manual-5.7021/lib/Catalyst/Manual/Cookbook.pod#___top 3) Looked at the perldoc for Catalyst::Authentication::Store::DBIx::Class http://search.cpan.org/~jayk/Catalyst-Authentication-Store-DBIx-Class-0.1082/lib/Catalyst/Authentication/Store/DBIx/Class.pm Any calls made to 'check_user_roles' doesn't work in my application. I followed the tute with some minor changes Questions: == Referring to the perldoc for Catalyst::Authentication::Store::DBIx::Class *) 'user_role_user_field' = 'user' That doesn't come with any description. Is that meant for a authentication authorisation similar to the tute (as in there are 3 database tables: User, Role and UserRole ) ? Referring to the cookbook on 'Role-based Authorization (configuration section) -Extract from configuration section - START -- __PACKAGE__-config-{authentication} = { default_realm = 'members', realms = { members = { credential = { # ... }, store = { class = 'DBIx::Class', user_model = 'MyApp::User', role_relation = 'roles', role_field = 'rolename', ignore_fields_in_find = [ 'remote_name' ], use_userdata_from_session = 1, } } } }; -Extract from configuration section - END -- Assuming the following databases, I find myself lost. Database table: Users = Table public.users Column |Type | Modifiers +-+ id | integer | not null default nextval('users_id_seq'::regclass) password | text| not null first_name | text| last_name | text| active | integer | main_contact_id| integer | company_name | text| billing_details_id | integer | billing_address_id | integer | created_by | character varying(12) | updated_by | character varying(12) | created_on | timestamp without time zone | updated_on | timestamp without time zone | login_id | character varying(20) | not null abn| text| Indexes: users_pkey PRIMARY KEY, btree (id) unique_login_id UNIQUE, btree (login_id) Relationships: == __PACKAGE__-has_many( 'map_user_role' = 'myApp::Schema::UserRoles', 'user_id'); Database table: user_roles == Table public.user_roles Column | Type | Modifiers -+-+--- user_id | integer | not null role_id | integer | not null Indexes: user_roles_pkey PRIMARY KEY, btree (user_id, role_id) Relationships: == __PACKAGE__-belongs_to( 'user' = 'myApp::Schema::Users', 'user_id'); __PACKAGE__-belongs_to( 'role' = 'myApp::Schema::Roles', 'role_id'); Database table: roles === Table public.roles Column | Type | Modifiers +-+ id | integer | not null default nextval('roles_id_seq'::regclass) role | text| Indexes: roles_pkey PRIMARY KEY, btree (id)
Re: [Catalyst] How do I set the default view in Catalyst?
That's exactly right. So you'll be saying: __PACKAGE__-config( default_view = 'TT' ); in MyApp.pm hello, Tom, thank you and have a good day! k. akimoto ___ 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/
Re: [Catalyst] Application stallling problem
hi, all, I found that the problem again. 1) I ran my application with DBIC_TRACE=1 ie DBIC_TRACE=1 myapp_server.pl -d 2) When I clicked on a link which shows me all the subscription listings belonging to an agent, the application loads the page just fine (and quickly) 3) I then moved on to click a link within the page which shows the details of a given listing. 4 ) Application stalls What I have done: - Opened up new terminal - Ran top - Observed that my server process is taking up 60% of the CPU - load average is 1.31, 1.00, 0.81 - Here's what the catalyst debug screen looks like: -+--' You can connect to your server at http://lginsurance.com.au.hosting24.com.au:3000 SELECT me.id, me.user_id, me.subscriptions_id, me.name, me.rea_agent_code, me.domain_agent_code, me.logo_file, me.logo_url, me.active_from, me.active_to, me.comments, me.created_by, me.updated_by, me.created_on, me.updated_on, subscription.id, subscription.type, subscription.name, subscription.price, subscription.currency, subscription.property_type_access, subscription.comments, subscription.created_by, subscription.updated_by, subscription.created_on, subscription.updated_on FROM user_subscriptions me JOIN subscriptions subscription ON subscription.id = me.subscriptions_id WHERE ( user_id = ? ): 'test_agent' SELECT COUNT( * ) FROM user_subscriptions me JOIN subscriptions subscription ON subscription.id = me.subscriptions_id WHERE ( user_id = ? ): 'test_agent' [debug] GET request for users/subscriptions/ from 123.243.50.59 [debug] Found sessionid b061fb50b6799c8e1deb11ecd8f5011b6fc99244 in cookie [debug] Restored session b061fb50b6799c8e1deb11ecd8f5011b6fc99244 [debug] Path is users/subscriptions [debug] Root.pm - Begin [debug] Root.pm - auto and path is users/subscriptions/ [debug] Rendering template agents/subscriptions/list.tt2 [debug] Applying HTML page layout wrappers to agents/subscriptions/list.tt2 Any ideas? I suspected postgres to be the culprit but it's not taking any percentage of load on the CPU (from reference to 'top'). ___ 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/
[Catalyst] How do I set the default view in Catalyst?
hi guys I been reading up on 1) the tute , http://search.cpan.org/~hkclark/Catalyst-Manual-5.7020/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod#CATALYST_VIEWS, 2) http://search.cpan.org/~mramberg/Catalyst-View-TT-0.29/lib/Catalyst/View/TT.pm#CONFIGURATION 3) http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg00630.html I have a view named myApp::View::TT which I have a file, myApp/View/TT.pm defined. From what I have read, to set default view to TT, I have to declare 'default_view' = 'TT', in my myApp.pm file. I have tried different values for default_view (ie. myApp::View::TT and View::TT) but they do not work either. please advise. thank you ___ 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/
Re: [Catalyst] Application stallling problem
Catalyst 5.8 doesn't do this. If you're using 5.8 that's not the problem. hello, Ian, thanks for the reply. I have upgraded my catalyst runtime to version 5.8. I will report to the mailing list if this problem comes up again. So far, I have observed it once (with catalyst runtime 5.8). Alas, I was't running myapp_server.pl with the -d flag (as per Kieren Diment's recommendation) to see where the problem brewed from. thank you K. akimoto ___ 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/
Re: [Catalyst] Application stallling problem
hi Kieren and everyone:) I have sent through my templates in my previous reply. Could I please have some feedback when you are ready? Again, thank you everyone for your help ! :) K. akimoto ___ 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/
Re: [Catalyst] Application stallling problem
Kieren- try running your server under the debugger i.e. script/myapp_server.pl -d and hit control-c where the application stalls to see where in the code it's stalling. Hello, Kieren, Good morning. Strangely I tried it and it seems to be acting right. I will keep your instructions handy and if I spot the problem again, I will post to the thread. Thank you:) K. akimoto ___ 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/
[Catalyst] upgraded to latest catalyst runtime 5.8 and Catalyst::Plugin::Upload::Image::Magick::Thumbnail::Fixed cant be loaded
hi guys i thought i upgrade my server's catalyst runtime package to the latest one. When I tried running my app, i got this error: Could not load class (Catalyst::Plugin::Upload::Image::Magick::Thumbnail::Fixed) because : You are trying to modify Catalyst::Request::Upload, which has been made immutable, this is not supported. Try subclassing Catalyst::Request::Upload, rather than monkeypatching it at /usr/local/lib/perl5/site_perl/5.8.9/MooseX/Emulate/Class/Accessor/Fast.pm line 107 Catalyst::Component::mk_accessors('Catalyst::Request::Upload', '_thumbnail_fixed', '_thumbnail_temp') called at /usr/local/lib/perl5/site_perl/5.8.9/Catalyst/Plugin/Upload/Image/Magick/Thumbnail/Fixed.pm line 108 require Catalyst/Plugin/Upload/Image/Magick/Thumbnail/Fixed.pm called at /usr/local/lib/perl5/site_perl/5.8.9/x86_64-linux/Class/MOP.pm line 136 ... This is what part of my lib/MyApp.pm looks like: use Catalyst qw( -Debug ConfigLoader Static::Simple StackTrace Authentication Authentication::Store::DBIC Authentication::Credential::Password Authorization::ACL Authorization::Roles Cache Cache::Store::FastMmap FormValidator Session Session::Store::FastMmap Session::State::Cookie Upload::Image::Magick Upload::Image::Magick::Thumbnail::Fixed ); Anyway, i went to lib/MyApp.pm and removed ' Upload::Image::Magick::Thumbnail::Fixed' and ran the app. Bear in mind I still had ' Upload::Image::Magick' there. When I tried to run script/myApp_server.pl again, I got this error: Could not load class (Catalyst::Plugin::Upload::Image::Magick) because : You are trying to modify Catalyst::Request::Upload, which has been made immutable, this is not supported. Try subclassing Catalyst::Request::Upload, rather than monkeypatching it at /usr/local/lib/perl5/site_perl/5.8.9/MooseX/Emulate/Class/Accessor/Fast.pm line 107 Catalyst::Component::mk_accessors('Catalyst::Request::Upload', '_image') called at /usr/local/lib/perl5/site_perl/5.8.9/Catalyst/Plugin/Upload/Image/Magick.pm line 50 require Catalyst/Plugin/Upload/Image/Magick.pm called at /usr/local/lib/perl5/site_perl/5.8.9/x86_64-linux/Class/MOP.pm line 136 eval {...} called at /usr/local/lib/perl5/site_perl/5.8.9/x86_64-linux/Class/MOP.pm line 136 Class::MOP::_try_load_one_class('Catalyst::Plugin::Upload::Image::Magick') called at /usr/local/lib/perl5/site_perl/5.8.9/x86_64-linux/Class/MOP.pm line 99 ... Try subclassing Catalyst::Request::Upload, -- What does it mean and how do I go about doing it? Then again, another question would be, is it a core issue? . thank you for your time. I look forward to hearing some comments. K. akimoto ___ 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/
Re: [Catalyst] upgraded to latest catalyst runtime 5.8 and Catalyst::Plugin::Upload::Image::Magick::Thumbnail::Fixed cant be loaded
Any suggestions for a sane(r) approach? As it's a plugin I've used I might be able to find some tuits to experiment with an implementation. Are there many of us using ImageMAgick in their apps? I'm just tempted to use Catalyst::Request and Image::Magick::Thumbnail::Fixed or Image::Resize directly (ie not as a Catalyst plugin). ___ 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/
Re: [Catalyst] upgraded to latest catalyst runtime 5.8 and Catalyst::Plugin::Upload::Image::Magick::Thumbnail::Fixed cant be loaded
My method is to have what essentially amounts as a file type dispatcher which takes incoming uploads passed in, then redirects to whatever is the most appropriate model class. Yep, I think I get what you mean. This is such that multiple controllers can make use of the upload method in your BASE model class. Right? thank you K. akimoto ___ 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/
[Catalyst] Similar attribute appears twice despite a single POST (submit) request.
Hi, everyone, I have come across something interesting. 1) User opens up a page that lists all his/her subscriptions 2) Each subscription is a url and a parameter at the end (ie 'id=3325') 3) User decides to edit one of the subscriptions. He/she clicks on one with an id of 3389 (hence the url will point to http://lginsurance.com.au/subscriptions/edit?id=3389;) 4) My controller, sub edit gets called, it works out some hidden values and returns a web form/ 5) The web form contains the following: a) 'name' = Text box for subscription alias b) 'nominated_agent_code' = Text box for nominated agent code c) 'id' = Hidden value which has the id of the current subscription in question 5.5) The url is now http://lginsurance.com.au/subscriptions/edit?id=3389; 6) The user makes the necessary changes to name and/or nominated agent code on the web form and clicks 'submit' 6.5) The Catalyst debug is as follows. Observe that the 'id' appears twice! [info] *** Request 3 (0.176/s) [24288] [Wed Apr 29 20:57:20 2009] *** [debug] Query Parameters are: .-+--. | Parameter | Value | +-+--+ | id | 3389 | '-+--' [debug] Body Parameters are: .-+--. | Parameter | Value | +-+--+ | id | 3389 | | name| fire and theft-main concourse level | | submit | submit | | nominated_agent_id | 4| '-+--' [debug] POST request for users/subscriptions/update from 123.243.50.59 [debug] Found sessionid d11552045b04ccd6734582a4220d47398d022325 in cookie [debug] Restored session d11552045b04ccd6734582a4220d47398d022325 7) my controller, sub edit gets called. This time, I extract all the values I got from the web form using $c-request-params-{ attribute-name }; where attribute-name would be 'name','nominated_agent_code' and 'id'. When I used data dumper to print out the value I got for 'id' , I observed that 'id' is made out of an array of two values: '3389' and '3389' (yet again!). Guys, if the user is clicking on the submit button in step 6, that's a POST request. So, why is the a 'query parameters' block present? From my understanding, a query_parameter block is for GET requests. I know that to get the 'id' I want which is from the body parameters, I should use $c-request-body_parameters{'id'} but in doing so, it looks like I am avoiding the problem and its cause rather than understand what it is about. Help! ___ 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/
Re: [Catalyst] Similar attribute appears twice despite a single POST (submit) request.
Akimoto, You really need to read up on HTTP and the difference between Query Parameters and Body Parameters. It will help you write better applications. Hello, J, Good evening. Yes, you're very right and I have been referring to documentation on search.cpan.org especially the catalyst tutes, J Rockway's book and Catalyst::Request documentation. Yes, reading the Catalyst::Request documentation, I was aware that $c-request-params was a combination of both query and body parameters. Are you able to provide us with a good example of the usefulness of getting parameters from both query and body? I thought it would be neater to take the parameters from either one source only (not both ). Can you please recommend some documentation related to HTTP and the difference between Query Parameters and Body Parameters? I googled with 'HTTP and the difference between Query Parameters and Body Parameters.' but didn't get anything interesting. If you simply change your form tag to be form method=post action= http://lginsurance.com.au/subscriptions/edit; there will be no query parameter present. You most certainly have the action set to http://lginsurance.com.au/subscriptions/edit?id=3389;, which is what is populating the GET parameter. Yes, I made the change here and problem solved. I understand what you and Sebastian Willert mean now. I made sure that my form had an action of 'http://lginsurance.com.au/subscriptions/edit' (without ?id=3389) and it works beautifully. It now knows that it has to call my controller, sub edit which accepts requests of path, '/subscriptions/edit'. Thank you for your time, J! K. akimoto -Jay ___ 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/
Re: [Catalyst] Similar attribute appears twice despite a single POST (submit) request.
This is just a stab in the dark, but I guess your form tag is missing an action attribute and thus resends to the same URI, thus keeping the id query parameter. This is according to specification: nothing in HTTP disallows using GET-Parameters in POST requests IIRC. Cheers, Sebastian Yes, I made sure that the action of the form is now pointing to '/subscriptions/edit' and it works beautifully. Problem solved. Thank you, Sebastian. K. akimoto ___ 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/
Re: [Catalyst] Can't seem to use forward or detach. Any special requirements?
Yes. If you detach(), you're basically saying 'do nothing more on this request'. That plus the redirect mean that template processing is not done, as I understand it. This is no doubt dealt with in the action Hi, Ian, The app works fine except that I have set up an eval block within my controller. My detach call comes right after the redirect call. It looks like this: $c-res-redirect($c-uri_for('/users/subscriptions/added ')); $c-detach (); What's weird is that on my terminal, the catalyst debug messages extract reads: [debug] User subscription (id, 1278) updated in database. [debug] update: trapped exception - catalyst_detach Any idea as to what this means? And please, please pay attention to what people are saying about your quoting style. You're *still* leaving the whole source message in your reply, and this is annoying a wide proportion of the list whose help you want. Yep, I am working on it. Sorry, everyone. Will improve:) Good night, all :) ___ 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/
Re: [Catalyst] Can't seem to use forward or detach. Any special requirements?
Another thought - what does $c-detach() do / what do you expect it to do? If you aren't detaching _to somewhere_, then why not just return? hello, tom, Good arvo. From what I have read in some of the docs (sorry, I dont have my bookmarks handy), they did mention that after a redirection, if one wishes to stop further processing, just issue a detach statement. that's how I got it. thank you for your help! k. akimoto ___ 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/
Re: [Catalyst] The Netiquette thread (OT)
This mailing list is for helping people. If you want to be helped, you'll get more sympathy from the people with the knowledge you need if you follow these guidelines. If you are offering help, I assume you want to aid the community, and driving people away from the mailing list with petty annoyances is not going to achieve that. Hello, Ian, Well said. Afterall, there's a few generations of programmers around these days. People like myself who only got to use mailing lists heavily say within last year do not know of the netiquette in practice. Thanks for providing a heads up. K. akimoto ___ 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/
Re: [Catalyst] Can't seem to use forward or detach. Any special requirements?
Hi, everyone, I know that most people here would understand redirect, forward and detach well. Unfortunately, there are people like myself who don't understand it that well and hence, after looking at the CPAN catalyst docs and J.Rockway's book, still fail to find a page that defines these methods and differentiates them clearly. i hope someone can help shed some light here. Here it goes: Looking at the doc for Catalyst::Response-redirect ( http://search.cpan.org/~flora/Catalyst-Runtime-5.80002/lib/Catalyst/Response.pm#$res-%3Eredirect(_$url,_$status_) ), can anyone tell me - do the request parameters still stay when redirected? - how about the stash values? do they persist after the redirection? I do not think so but it's good to have some confirmation. - This is a convenience method that sets the Location header to the redirect destination, and then sets the response status. You will want to return; or $c-detach() to interrupt the normal processing flow if you want the redirect to occur straight away - Could anyone please give some examples of this? do we do something like: $c-res-redirect ($c-uri_for('subscriptions/confimation')); return 0; or something? thanks! k. akimoto ___ 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/
Re: [Catalyst] Can't seem to use forward or detach. Any special requirements?
hello, J.Shirley, Good morning. Sorry if this post is being replied to at the top of the message in light of not further causing some disastifactions in the mailing list (majority). Firstly, a big thank you for your response and confirmations. Yep, I did try experimenting with my current app and it's taken some time. I then hit the documentation and found that it would be better for me to enquire with the mailing list. Of course, the facts documented here in the mailing list would certainly benefit others (especially those who are starting to get their feet into the Catalyst pool). thank you. K. akimoto Please respond just at the bottom of the message! 1) Preserve request parameters, you can access all the parameters through $c-req-params and then append them when creating a new URL. $c-uri_for( 'somewhere', $params ). 2) Yes, you have to copy any values you want to live longer than one request to the flash. You can access them via $c-flash or $c-stash. I honestly didn't know about the flash_to_stash config parameter, so try it and see. You won't get better until you just try this stuff out. Create a simple Catalyst application you can use just to experiment. Learn how the redirect cycle affects the browser (especially after POST, http://en.wikipedia.org/wiki/Post/Redirect/Get) Throw away Catalyst apps are very useful for learning how HTTP works. Catalyst's debug output is really fantastic. Combine that with Firefox + Firebug and the Network panel, you get a huge amount of information. -J ___ 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/
Re: [Catalyst] Can't seem to use forward or detach. Any special requirements?
Hello, Mr Wells, Good morning and a big thank you for your reply. It was pretty accurate. Last night, I managed to get my problem fixed by using a redirect prior to receiving your reply. Basically, my solution was conceptually on the same lines as the proposed solution which you had given. 1) Web browser requests for /user/subscriptions/add, 2) Catalyst controller (sub add) finds that it's just an initialisation hence works out some required hidden ids and stores them into the stash. 3) A template, add.tt2 gets used to render a web form for input 4) Approapriate input gets entered by the user and user clicks on the submit button. 5) Catalyst controller (sub add) finds that it's a submission (by means of the request method being a POST) and performs data validation and creates new database table entry if validation was successful. 6) The new entry's database ID (primary key) and a predefined mesage of success then gets placed in the flash along. 7) Catalyst controller then performs a redirect to /user/subscriptions/added. 8) A call to detach (ie. $c-detach ();) appears right after the redirect statement. My code looks like this: $c-log-debug(q{ Entry processed.}); $c-res-redirect($c-uri_for('/users/subscriptions/added ')); $c-detach (); 9) As soon as the redirect takes place, another catalyst controller, 'sub added :Local ' gets called and yes, a template , added.tt2 gets used for rendering. It works and I have regression tests made when I was developing the controller to make sure it acts as it should. All good there:) Problem I was trying to solve: - To use one controller as much as possible for adding a new entry. - Problem is that if anyone should hit the F5 key or refresh button on their browser after a successful entry into the database ( where a message of success gets shown and request parameters are still active), an unintended new entry gets created on the database table. - I tried many ways (ie setting flags in the flash upon successful creation of a database entry) but they have seem to fail . I have also tried forwarding and detaching to no success. A question on your proposed solution --- Web browser asks for /user/subscriptions/add, posting parameters, in order to create a new row in the DB. = On the server, your website code creates a new row in the DB = Server outputs a redirect to a page that lists the objects, let's say /user/subscriptions/list and calls detach() without outputting a page at all. (No template is called.) Assuming that when the browser asks for /user/subscriptions/add (along with the necessary posting parameters), the controller called is sub add. I would assume that when you mention that 'No template is called', that's on the same controller (ie sub add). Am I correct? Thank you again for your time and patience, everyone. K. akimoto. Quoting Ian Wells i...@cack.org.uk: 2009/4/27 kakim...@tpg.com.au: Hello, J. Shirley, Thank you for your explaination. It made things much clearer and confirmed a lotta things. Akimoto-san, people have been answering the questions that you've asked, but I wanted to check up what it is that you're trying to do. Tell me if I have this right: 1. the problem you're trying to avoid: Web browser asks for /user/subscriptions/add, posting parameters, in order to create a new row in the DB. = On the server, your website code creates a new row in the DB = Server outputs a list of objects. Guy using web browser presses refresh, to show the list again = On the server, your website code creates a new row in the DB (which the user didn't want). = Server outputs a list of objects. 2. the way you're trying to avoid it I'm not quite sure *what* you're trying to do, but it's a bit confused, so let's sklip to 3. the way you *should* be doing it Web browser asks for /user/subscriptions/add, posting parameters, in order to create a new row in the DB. = On the server, your website code creates a new row in the DB = Server outputs a redirect to a page that lists the objects, let's say /user/subscriptions/list and calls detach() without outputting a page at all. (No template is called.) Web browser receives redirect, asks for the page that lists the objects. at /user/subscriptions/list = Server outputs a list of objects. Guy using web browser presses refresh, to show the list again (and note that because of the redirect this now loads /user/subscriptions/list) = Server outputs a list of objects. People are steadily trying to steer you towards (3) above. In (3) you shouldn't be passing all the parameters to the create operation to the list page (e.g. the new object name doesn't need to go to the list page), so they shouldn't be on the redirect. However, you might have filters and
Re: [Catalyst] Can't seem to use forward or detach. Any special requirements?
Hello, Oliver, Good morning. Referring to http://kobesearch.cpan.org/htdocs/Catalyst-Runtime/Catalyst.html#c_gt_detach_class_method_arguments, under $c-detach(), it says that detach is the same as forward, but doesn't return to the previous action when processing is finished. Comments? thank you k. akimoto Quoting oliver.g.char...@googlemail.com: kakim...@tpg.com.au wrote: hello, all, I have a method in my controller which adds entries. The method is setup to match the path of 'users/subscriptions/add'. Upon successfully adding entries, I want the same method to be executed again (only that the method will know which template (view) to call. I tried using a detach (and even a forward) and I keep getting an error of , 'Couldn't forward to command /users/subscriptions/add: Invalid action or component.' This is because the path you specified is not the internal path name to the action (that is whatever you named your controller /create), but it is the external path. Detach works on internal path names. Reason why I am issuing a detach - To prohibit users from pressing Refresh on the browser which will cause the application to readd the entry again into the database (this happens because I suspect that the request object is not flushed. I could easily kill off the parameters in the request object but I figured I use a detach and have another (view) template show up. Detach will simply cause another action to be executed before returning to the browser, so this won't solve your problem. You need to cause a redirect to solve your problem, so the correct code would be: $c-res-redirect($c-uri_for_action('/controller/create') Where controller is the name of the controller that contains the action you provided in your email. Hope that helps -- Oliver Charles / aCiD2 ___ 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/ ___ 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/
[Catalyst] Having trouble even perldoc-ing Catalyst::Authentication::Store::DBIx::Class :(
hi, everyone, I used to use Catalyst::Authentication::Store::DBIC with Catalyst 5.71000. The installation went fine. Here's an extract: -- Start-- r...@lginsurance:/root/perl-packages/Catalyst-Authentication-Store-DBIx-Class-0.1082# perl Makefile.PL Cannot determine perl version info from lib/Catalyst/Authentication/Store/DBIx/Class.pm *** Module::AutoInstall version 1.03 *** Checking for Perl dependencies... [Core Features] - Test::More ...loaded. (0.86) - Catalyst::Runtime...loaded. (5.71) - Catalyst::Plugin::Authentication ...loaded. (0.10011 = 0.10008) - Catalyst::Model::DBIC::Schema...loaded. (0.23) - DBIx::Class ...loaded. (0.08012) - Catalyst::Model::DBIC::Schema...loaded. (0.23 = 0.18) *** Module::AutoInstall configuration finished. Checking if your kit is complete... Looks goodWriting Makefile for Catalyst::Authentication::Store::DBIx::Class r...@lginsurance:/root/perl-packages/Catalyst-Authentication-Store-DBIx-Class-0.1082# ls r...@lginsurance:/root/perl-packages/Catalyst-Authentication-Store-DBIx-Class-0.1082# make test PERL_DL_NONLAZY=1 /usr/local/bin/perl -MExtUtils::Command::MM -e test_harness(0, 'inc', 'blib/lib', 'blib/arch') t/00-load.t t/01-pod.t t/02-pod-coverage.t t/03-authtest.t t/04-authsessions. t t/05-auth-roles-relationship.t t/06-auth-roles-column.t t/07-authsessions-cached.t t/08-simpledb-auth-roles-relationship.t t/09-simpledb-auth-roles-column.t t/00-load.t .. 1/1 # Testing Catalyst::Authentication::Store::DBIx::Class 0.1082, Perl 5.008009, /usr/local/bin/perl t/00-load.t .. ok t/01-pod.t ... ok t/02-pod-coverage.t .. skipped: Test::Pod::Coverage 1.04 required for testing POD coverage t/03-authtest.t .. ok t/04-authsessions.t .. ok t/05-auth-roles-relationship.t ... ok t/06-auth-roles-column.t . ok t/07-authsessions-cached.t ... ok t/08-simpledb-auth-roles-relationship.t .. [warn] realm default configured using a plaintext password type. This is not secure. t/08-simpledb-auth-roles-relationship.t .. ok t/09-simpledb-auth-roles-column.t [warn] realm default configured using a plaintext password type. This is not secure. t/09-simpledb-auth-roles-column.t ok All tests successful. Files=10, Tests=67, 7 wallclock secs ( 0.04 usr 0.04 sys + 2.93 cusr 0.50 csys = 3.51 CPU) Result: PASS r...@lginsurance:/root/perl-packages/Catalyst-Authentication-Store-DBIx-Class-0.1082# make install Appending installation info to /usr/local/lib/perl5/5.8.9/x86_64-linux/perllocal.pod -- End-- But, as soon as I tried to even perldoc the module, here's what I got. -- Start-- r...@lginsurance:/root/perl-packages/Catalyst-Authentication-Store-DBIx-Class-0.1082# !perldoc perldoc Catalyst::Authentication::Store::DBIx::Class Insecure dependency in require while running with -T switch at /usr/local/lib/perl5/5.8.9/Pod/Perldoc.pm line 1634. -- End-- And of course, running my application isn't successful: -- Start-- kakim...@lginsurance:~/projects/myApp$ script/myApp_server.pl Can't locate Catalyst/Plugin/Authentication/Store/DBIx/Class.pm in @INC (@INC contains: /home/kakimoto/projects/myApp/script/../lib /usr/local/lib/perl5/5.8.9/x86_64-linux /usr/local/lib/perl5/5.8.9 /usr/local/lib/perl5/site_perl/5.8.9/x86_64-linux /usr/local/lib/perl5/site_perl/5.8.9 . /home/kakimoto/projects/myApp/lib/myApp/Schema) at /usr/local/lib/perl5/site_perl/5.8.9/Catalyst/Utils.pm line 272. Compilation failed in require at script/myApp_server.pl line 56. kakim...@lginsurance:~/projects/myApp$ -- End-- any ideas? thanks ___ 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/
Re: [Catalyst] how to reuse Catalyst Schema for non-web purposes?
Gah Thanks, moritz.. 2am here and my coffee's runnin' low. haha that's the case i figure. I will give it a go tomorrow. Cheers! Quoting Moritz Onken on...@houseofdesign.de: So it's the model I put the business logic in? That sounds ok, for now. But what about this: * Input from the web has to be validated. May be I use Data::FormValidator, may be FormFu. However, I may have to validate the params I get from the script (eg. data import from ERP systems), too. Do I have to implement the validation again? And maybe normalization/converting, too? Or where would you place these functionality? Extra modules? You are not limited by the number of models. You can write a model which does the form/data validation and which calls the dbic model to insert the data. Just place an extra layer between your controller and your dbic model. * What about business logic that is in not only bound to a specific schema but has an overall logic that fetches data from different tables, adds some somewhere and produces results? How would you implement such a logic? Any examples? I would write an extra model for this or you create a resultset class which can handle that. This very much depends on the data which is needed. * An example for using data and logic outside of the web app would be generating invoices by night. That process would bring out some PDFs which will be printed or sent by mail through another script. Shouldn't a view be involved in this process that builds the PDFs from templates? Is it possible to build this example upon a Catalyst web app? Examples? I use Template::Plugin::Latex to create a TeX document which is then converted to a pdf. But this is totally independent from catalyst. It is a script which is run once a day and generates the invoices. No need to follow the MVC scheme here. If you plan to run those jobs with catalyst I'll suggest you have a look a job queue which can help you with that (e.g. TheSchwartz). moritz ___ 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/ ___ 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/
Re: [Catalyst] how to reuse Catalyst Schema for non-web purposes?
I took off the 'Authentication::Store::DBIC' from my use Catalyst qw( in myApp.pm. This is such that Catalyst/Plugin/Authentication/Store/DBIx/Class.pm will not be required. After all, no such thing exists(checked cpan). Strangely, when I run scripts/myApp_server.pl, I got this message: -- error message - start [error] Caught exception in myApp::Controller::Root-auto Can't call method user_is_restorable on an undefined value at /usr/local/lib/perl5/site_perl/5.8.9/Catalyst/Plugin/Authentication.pm line 168. -- error message - end I found a thread which I think is fairly similar. It's http://www.mail- archive.com/catalyst@lists.scsys.co.uk/msg04758.html. Going to give it a go and will share with you guys on my findings:) K. akimoto Quoting kakim...@tpg.com.au: Gah Thanks, moritz.. 2am here and my coffee's runnin' low. haha that's the case i figure. I will give it a go tomorrow. Cheers! Quoting Moritz Onken on...@houseofdesign.de: So it's the model I put the business logic in? That sounds ok, for now. But what about this: * Input from the web has to be validated. May be I use Data::FormValidator, may be FormFu. However, I may have to validate the params I get from the script (eg. data import from ERP systems), too. Do I have to implement the validation again? And maybe normalization/converting, too? Or where would you place these functionality? Extra modules? You are not limited by the number of models. You can write a model which does the form/data validation and which calls the dbic model to insert the data. Just place an extra layer between your controller and your dbic model. * What about business logic that is in not only bound to a specific schema but has an overall logic that fetches data from different tables, adds some somewhere and produces results? How would you implement such a logic? Any examples? I would write an extra model for this or you create a resultset class which can handle that. This very much depends on the data which is needed. * An example for using data and logic outside of the web app would be generating invoices by night. That process would bring out some PDFs which will be printed or sent by mail through another script. Shouldn't a view be involved in this process that builds the PDFs from templates? Is it possible to build this example upon a Catalyst web app? Examples? I use Template::Plugin::Latex to create a TeX document which is then converted to a pdf. But this is totally independent from catalyst. It is a script which is run once a day and generates the invoices. No need to follow the MVC scheme here. If you plan to run those jobs with catalyst I'll suggest you have a look a job queue which can help you with that (e.g. TheSchwartz). moritz ___ 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/ ___ 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/ ___ 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/
Re: [Catalyst] how to reuse Catalyst Schema for non-web purposes?
Hello. Matt, Good morning. Here's the execution output of the regression test and source code of the regression test. Execution of test - start kakim...@dev-machine:~/projects/myApp/t$ prove -v userSubscriptions.t userSubscriptions.t .. ok 1 - use myApp::Schema::UserSubscriptions; ok 2 - The object isa myApp::Schema::UserSubscriptions ok 3 - myApp::Schema::UserSubscriptions-can('subscriptions_id') ok 4 - myApp::Schema::UserSubscriptions-can('name') ok 5 - myApp::Schema::UserSubscriptions-can('user_id') ok 6 - myApp::Schema::UserSubscriptions-can('comments') ok 7 - myApp::Schema::UserSubscriptions-can('rea_agent_code') 1..7 Can't call method resolve on an undefined value at /usr/local/lib/perl5/site_perl/5.8.9/DBIx/Class/Row.pm line 720. # Looks like your test exited with 255 just after 7. Dubious, test returned 255 (wstat 65280, 0xff00) All 7 subtests passed Test Summary Report --- userSubscriptions.t (Wstat: 65280 Tests: 7 Failed: 0) Non-zero exit status: 255 Files=1, Tests=7, 3 wallclock secs ( 0.02 usr 0.01 sys + 0.17 cusr 0.03 csys = 0.23 CPU) Result: FAIL Execution of test - end -- Regression test source-start-- use strict; use warnings; use FindBin; use File::Spec qw(); use lib File::Spec-catdir($FindBin::Bin, qw(.. lib)); use Test::More qw(no_plan); my $package_name = 'myApp::Schema::UserSubscriptions'; BEGIN { use_ok( 'myApp::Schema::UserSubscriptions' ); } # Set up a user's subscriptions. my %existing_agent = ( qq{username} = qq{test_back_end_agent}, ); my @user_subscriptions = ( { 'name' = 'first subscription', 'subscriptions_id' = '12', 'user_id' = $existing_agent{'username'}, 'comments' = 'test user subscription', 'agent_code' = 'LATHAM', }, ); foreach my $new_subscription ( @user_subscriptions ) { my $new_user_sub = $package_name-new(); isa_ok ( $new_user_sub, $package_name ); foreach my $attr ( keys %{$new_subscription} ) { can_ok ($new_user_sub, $attr); $new_user_sub-$attr($new_subscription); } $new_user_sub-insert(); } -- Regression test source-end-- Thank you. K.akimoto Quoting Matt S Trout dbix-cl...@trout.me.uk: On Wed, Apr 22, 2009 at 02:41:34PM +1000, kakim...@tpg.com.au wrote: hi guys, I just looked at my app and found that I need to reuse the Schema files found in my 'Schema' directory. Your DBIC classes aren't connected to the Catalyst app at all. That's intentional. Just use DBIx::Class the way DBIx::Class is documented in and of itself. The DBIx::Class list is also on http://lists.scsys.co.uk/ if you get stuck - if you're getting an error show your code and the complete error on there. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Director http://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/ ___ 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/ ___ 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/
Re: [Catalyst] Keep getting checksum mismatch problems each time I regenerate my schema files
Hi there I think I know why. Because I use the TimeStamp component, I guess I should have executed the command as per the tute (http://search.cpan.org/~hkclark/Catalyst-Manual-5.7020/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod) with the 'components=TimeStamp'. command: script/myapp_create.pl model DB DBIC::Schema MyApp::Schema create=static components=TimeStamp dbi:SQLite:myapp.db Quoting Tomas Doran bobtf...@bobtfish.net: This discussion should be on the DBIC list really, as it doesn't have much to do with Catalyst. On 17 Apr 2009, at 03:27, kakim...@tpg.com.au wrote: Quoting John Romkey rom...@apocalypse.org: Look in the schema file. You see this line? # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum: it means that you modified that line or something above it... Yes I do see the line. If the way the check is to be done is so stringent (ie. permissions on the files it touches or even new lines, surely, the makers of this package could come up with somethign better. I don't have the same issue when using Ruby on Rails' Active Records). What? There is nothing done with permissions, I have no idea what you're talking about with that. And I can't think of a better way to ensure that someone hasn't altered the generated code than what is done. Conceptually you _could_ in some way get the optree of the code, rather than the text, and then checksum that (so that you could add new lines and spaces and comments to the generated code), but this is _extremely non- trivial_ to implement, and also still wouldn't provide a way to leave your modifications in place when the code was re-generated, so I don't see any benefit to investigating it. Saying ActiveRecord doesn't do this isn't really helpful - you're not comparing like with like here.. ActiveRecord does around the same as 'create=dynamic' for schema mode, so there really _is no generated code_, as its introspected each time. You _can_ do your schema like this if you want to, but that opens a whole load of different issues I won't go into here (which ActiveRecord also suffers from). Cheers t0m ___ 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/ ___ 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/
Re: [Catalyst] how to reuse Catalyst Schema for non-web purposes?
Hello, Peter, I had a look at your ExtJs app via the url given in this email. Basically, the script just makes direct calls to the Model. Business logic is found in the script itself and not the Model . Unfortunately, I still can't see the importance of business logic being placed in the Model than the Controller. Nevertheless, simon Wilcox's opinion in one of the emails in this thread does bring some good weight for thought. thank you. k. akimoto Quoting Peter Edwards pe...@dragonstaff.com: 2009/4/22 kakim...@tpg.com.au Good morning. I am interested in hearing more about this. IMO the best place for your business logic is the controller. A view is made out of the html (usually templated with a templating system such as template toolkit). For example, in an application that sells insurance (doing away with any javascript which does any business logic): Okay, imagine the situation where you wish to send out insurance renewal reminders. You want to run it from a batch program so you can merge it to PDF and email / print and snailmail all the customers. Obviously, there is no web screen involved! You wish to use the Catalyst DBIC business object Model to get at the data. How are you going to do that if you need to use the web controller? Agreed, you *could* run the web transactions and collect the data as, say, XML, but that would be very inefficient. That is why the recommendation is to make the Controller a very thin layer and to put as much business logic as possible in the Model. I wrote a (somewhat outdated) article for the Catalyst advent calendar a couple of years ago on how to do this: http://www.catalystframework.org/calendar/2007/14 Best wishes, Peter http://perl.dragonstaff.co.uk ___ 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/
Re: [Catalyst] how to reuse Catalyst Schema for non-web purposes?
Hello, Simon, Your points have good weight for thoughts. In fact, coming from many backgrounds pre-Catalyst and pre-MVC (ie many a times, the templating system ie Mason would do the job of both controller and view incorporating the business logic), I have been able to write regression tests to test methods within an ORM. When I first started using Catalyst, I looked at the tutes and so forth and it seemed to me that the only form of testing is just web based (ie using web robots like Test::WWW::Mechanize::Catalyst). Whilst that allowed a good test of the interface and functionality as a whole(akin a blackbox), I missed the days when I had to develop something without the web front end and have it work for both web and back end(ie via scripts). Your arguments here have raised a direction for me to put my business logic into the model component of my app. Nevertheless, can I ask for some references to examples of business logic being written in the model? I can't seem to observe any from the Catalyst tutes. thank you K. akimoto Quoting Simon Wilcox sim...@digitalcraftsmen.net: On 22/4/09 23:03, kakim...@tpg.com.au wrote: IMO the best place for your business logic is the controller. Then you're wrong, at least in the eyes of many people. http://en.wikipedia.org/wiki/Model-view-controller The Controller is just a layer that converts the input to something that can be passed to the Model and then sends the output back to the user via a View. You *can* put all your logic in the controller but typically you will end up with two problems: 1. Your app is tightly bound to a web framework and adding some other sort of user interaction, or extending the application code elsewhere becomes difficult, which is what started this thread isn't it ? 2. It becomes hard to test as you need to have the web framework running to run the tests. You should be able to test all of the use cases business interactions outside of the web framework. If you can't, then that's a code smell and an indicator that you have too much going on in your Controller classes. The Catalyst Model classes should really be a very thin shim over the top of your DBIx::Class Schema objects which is where all the 'heavy lifting' of the business process takes place. Hope that makes sense, Simon. ___ 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/
Re: [Catalyst] how to reuse Catalyst Schema for non-web purposes?
From the Catalyst tutes, I seem to get the impression that pretty much a lot of the business logic is done in the controller. I might be wrong but in http://search.cpan.org/~hkclark/Catalyst-Manual-5.7020/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod#___top (Add a Method to Process Form Values and Update Database), it seems that the task of creating a new entry for books in the database and establishing the right relationships to the book_authors db table is done in the sub form_create_do in the Controller. i suppose if a batch script were to be used to add in amany books, the logic there would be trapped in the controller. How do we put that logic into the Model? very interesting and I would like to hear more since I cant find any examples for putting business logic in the Model for catalyst on google. thank you. k. akimoto Quoting kakim...@tpg.com.au: Hello, Simon, Your points have good weight for thoughts. In fact, coming from many backgrounds pre-Catalyst and pre-MVC (ie many a times, the templating system ie Mason would do the job of both controller and view incorporating the business logic), I have been able to write regression tests to test methods within an ORM. When I first started using Catalyst, I looked at the tutes and so forth and it seemed to me that the only form of testing is just web based (ie using web robots like Test::WWW::Mechanize::Catalyst). Whilst that allowed a good test of the interface and functionality as a whole(akin a blackbox), I missed the days when I had to develop something without the web front end and have it work for both web and back end(ie via scripts). Your arguments here have raised a direction for me to put my business logic into the model component of my app. Nevertheless, can I ask for some references to examples of business logic being written in the model? I can't seem to observe any from the Catalyst tutes. thank you K. akimoto Quoting Simon Wilcox sim...@digitalcraftsmen.net: On 22/4/09 23:03, kakim...@tpg.com.au wrote: IMO the best place for your business logic is the controller. Then you're wrong, at least in the eyes of many people. http://en.wikipedia.org/wiki/Model-view-controller The Controller is just a layer that converts the input to something that can be passed to the Model and then sends the output back to the user via a View. You *can* put all your logic in the controller but typically you will end up with two problems: 1. Your app is tightly bound to a web framework and adding some other sort of user interaction, or extending the application code elsewhere becomes difficult, which is what started this thread isn't it ? 2. It becomes hard to test as you need to have the web framework running to run the tests. You should be able to test all of the use cases business interactions outside of the web framework. If you can't, then that's a code smell and an indicator that you have too much going on in your Controller classes. The Catalyst Model classes should really be a very thin shim over the top of your DBIx::Class Schema objects which is where all the 'heavy lifting' of the business process takes place. Hope that makes sense, Simon. ___ 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/ ___ 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/
Re: [Catalyst] how to reuse Catalyst Schema for non-web purposes?
Hello Kieren, thank you for the link, http://blog.hide-k.net/archives/2008/10/dbixclassresult_1.php. Please correct me if I am wrong. Say if I have a Schema file, Schema/Subscriptions.pm After the section, DO NOT MODIFY ANYTHING ABOVE THIS! , I start declaring functions (not methods). sub is_trial_period { # evaluate if trial period is over or not # as this has to be determined through a set # of business rules. ... } sub is_promo_period { # evaluate if promo period is still on or not # as this has to be determined through a set # of business rules. ... } Have I got the right idea? Thank you. K. akimoto Quoting Kieren Diment kie...@diment.org: On 23/04/2009, at 12:59 PM, kakim...@tpg.com.au wrote: From the Catalyst tutes, I seem to get the impression that pretty much a lot of the business logic is done in the controller. I might be wrong but in http://search.cpan.org/~hkclark/Catalyst-Manual-5.7020/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod#___top (Add a Method to Process Form Values and Update Database), it seems that the task of creating a new entry for books in the database and establishing the right relationships to the book_authors db table is done in the sub form_create_do in the Controller. i suppose if a batch script were to be used to add in amany books, the logic there would be trapped in the controller. How do we put that logic into the Model? very interesting and I would like to hear more since I cant find any examples for putting business logic in the Model for catalyst on google. This: http://blog.hide-k.net/archives/2008/10/dbixclassresult_1.php is the blog post that I worked it out in, despite the text being in a language I don't speak :) ___ 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/ ___ 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/
[Catalyst] how to reuse Catalyst Schema for non-web purposes?
hi guys, I just looked at my app and found that I need to reuse the Schema files found in my 'Schema' directory. This is because i need to write some batch scripts which will read the data in the databases and output to files in the server. I tried writing a regression test and put in 'use MyApp::Schema::SubscriptionPlans;' The problem was that there was always a 'resolve' error that came up. Basically, what I am doing is the opposite of Using existing DBIC (etc.) classes with Catalyst found in http://search.cpan.org/~hkclark/Catalyst-Manual-5.7020/lib/Catalyst/Manual/Cookbook.pod#___top. any ideas? thank you K. akimoto ___ 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/
Re: [Catalyst] upon successful login, how do i get redirect users back to the page they wanted to access previously?
Hello, everyone! thank you for your recommendations. I have looked at the http://dev.catalystframework.org/wiki/wikicookbook/nextpageredirect link and http://search.cpan.org/~hkclark/Catalyst-Manual-5.7020/lib/Catalyst/Manual/Tutorial/Authentication.pod. Here's an extract, As discussed in the previous chapter of the tutorial, flash allows you to set variables in a way that is very similar to stash, but it will remain set across multiple requests. Once the value is read, it is cleared (unless reset).. I tried using FLASH and yet it doesn't work for me. The value I set in the flash gets lost after a redirect. Sorry to ask but does flash really work and is it reliable? I know setting stuff in the session variable is definitely reliable. Here are some extracts. 1) I access www.lginsurance.com.au/subscriptions/add 2) Since I am not logged in, Root-auto() kicks in and calls Login-index() 3) The path which I am requesting for (being '/subscriptions/add') gets stored in the flash, $c-flash-{'requested_page'} 4) Looking at the debugging messages printed from Login.pm-, the $c-flash-{'requested_page'} is empty (ie lost!) 5) The login form appears in my web browser and I log in. 6) All good in that I have authenticated myself but the page that loads is the main menu (instead of the page I previously wanted which is www.lginsurance.com.au/subscriptions/add). Does flash really work or should I just use the session variable? Root.pm (start) -- sub auto : Private { my ($self, $c) = @_; $c-log-debug( Root.pm - auto and path is . $c-req-path() ); if ($c-controller eq $c-controller('Login')) { $c-log-debug( Root.pm - auto - asked for login path); return 1; } else{ if ($c-user_exists()) { my $requested_page = $c-flash-{'requested_page'}; $c-log-debug( Root.pm - auto - USER's logged in. Proceed.($requested_page)); if ( $requested_page ) { $c-log-debug( Root.pm - auto - Requested Path is getting redirected to.); $c-response-redirect( $requested_page ); $c-log-debug( Root.pm - auto - BACK FROM REDIRECTION... ); } return 1; } else { $c-log-debug( Root.pm - auto - USER's not logged in. Forcing login and setting 'requested_page' = . $c-req-pat h() ); $c-flash-{'requested_page'} = $c-req-path(); $c-log-debug( Root.pm - auto - USER's not logged in. RECHECKING THE 'requested_page' = . $c-req-path() ); $c-response-redirect($c-uri_for('/login')); return 0; } } Root.pm (end ) -- Login.pm (start ) -- sub index : Private { my ($self, $c) = @_; $c-log-debug( in login .pm ); my $requested_page = $c-flash-{'requested_page'}; $c-log-debug( Login.pm - index- the path for requested_page is .($requested_page)); # Get the username and password from form my $username = $c-request-params-{username} || ''; my $password = $c-request-params-{password} || ''; # If the username and password values were found in form if ($username $password) { # Attempt to log the user in if ($c-login($username, $password)) { $c-log-debug( Login.pm [authenticated current user] - index... ); # If successful, then let them use the application $c-response-redirect( $c-uri_for('/') ); return 1; } else { # Set an error message $c-stash-{error_msg} = Bad username or password.; } } # If either of above don't work out, send to the login page $c-stash-{template} = 'login.tt2'; return 1; } Login.pm (end ) -- Quoting Oliver Charles oliver.g.char...@googlemail.com: On Sat, Apr 18, 2009 at 2:34 AM, kakim...@tpg.com.au wrote: hi, everybody, [snip] upon successful login, how do i get redirect users back to the page they wanted to access previously (which is www.lginsurance.com.au/subcriptions/add)? At the moment, upon successful login, menu.tt2 will be called. At work we do this with http://tr.im/j75v . If an action requires the user to be authenticated, they call $c-forward('/user/login'). If they are logged in, that action returns immediately and the action can continue. Otherwise, the current URI is stored in session, and the login form is presented. Then, when the login is successful, the URI is restored, and the user is redirect. However... after seeing Devin's approach, which is essentially the same but without the session, I may change to that. I believe the
Re: [Catalyst] upon successful login, how do i get redirect users back to the page they wanted to access previously?
Hello, everyone! I just implemented the change by storing the value of the path that I wish to access into the session. It works:) Nevertheless, I would still like to find out about your thoughts on flash. Thank you K. akimoto Quoting kakim...@tpg.com.au: Hello, everyone! thank you for your recommendations. I have looked at the http://dev.catalystframework.org/wiki/wikicookbook/nextpageredirect link and http://search.cpan.org/~hkclark/Catalyst-Manual-5.7020/lib/Catalyst/Manual/Tutorial/Authentication.pod. Here's an extract, As discussed in the previous chapter of the tutorial, flash allows you to set variables in a way that is very similar to stash, but it will remain set across multiple requests. Once the value is read, it is cleared (unless reset).. I tried using FLASH and yet it doesn't work for me. The value I set in the flash gets lost after a redirect. Sorry to ask but does flash really work and is it reliable? I know setting stuff in the session variable is definitely reliable. Here are some extracts. 1) I access www.lginsurance.com.au/subscriptions/add 2) Since I am not logged in, Root-auto() kicks in and calls Login-index() 3) The path which I am requesting for (being '/subscriptions/add') gets stored in the flash, $c-flash-{'requested_page'} 4) Looking at the debugging messages printed from Login.pm-, the $c-flash-{'requested_page'} is empty (ie lost!) 5) The login form appears in my web browser and I log in. 6) All good in that I have authenticated myself but the page that loads is the main menu (instead of the page I previously wanted which is www.lginsurance.com.au/subscriptions/add). Does flash really work or should I just use the session variable? Root.pm (start) -- sub auto : Private { my ($self, $c) = @_; $c-log-debug( Root.pm - auto and path is . $c-req-path() ); if ($c-controller eq $c-controller('Login')) { $c-log-debug( Root.pm - auto - asked for login path); return 1; } else{ if ($c-user_exists()) { my $requested_page = $c-flash-{'requested_page'}; $c-log-debug( Root.pm - auto - USER's logged in. Proceed.($requested_page)); if ( $requested_page ) { $c-log-debug( Root.pm - auto - Requested Path is getting redirected to.); $c-response-redirect( $requested_page ); $c-log-debug( Root.pm - auto - BACK FROM REDIRECTION... ); } return 1; } else { $c-log-debug( Root.pm - auto - USER's not logged in. Forcing login and setting 'requested_page' = . $c-req-pat h() ); $c-flash-{'requested_page'} = $c-req-path(); $c-log-debug( Root.pm - auto - USER's not logged in. RECHECKING THE 'requested_page' = . $c-req-path() ); $c-response-redirect($c-uri_for('/login')); return 0; } } Root.pm (end ) -- Login.pm (start ) -- sub index : Private { my ($self, $c) = @_; $c-log-debug( in login .pm ); my $requested_page = $c-flash-{'requested_page'}; $c-log-debug( Login.pm - index- the path for requested_page is .($requested_page)); # Get the username and password from form my $username = $c-request-params-{username} || ''; my $password = $c-request-params-{password} || ''; # If the username and password values were found in form if ($username $password) { # Attempt to log the user in if ($c-login($username, $password)) { $c-log-debug( Login.pm [authenticated current user] - index... ); # If successful, then let them use the application $c-response-redirect( $c-uri_for('/') ); return 1; } else { # Set an error message $c-stash-{error_msg} = Bad username or password.; } } # If either of above don't work out, send to the login page $c-stash-{template} = 'login.tt2'; return 1; } Login.pm (end ) -- Quoting Oliver Charles oliver.g.char...@googlemail.com: On Sat, Apr 18, 2009 at 2:34 AM, kakim...@tpg.com.au wrote: hi, everybody, [snip] upon successful login, how do i get redirect users back to the page they wanted to access previously (which is www.lginsurance.com.au/subcriptions/add)? At the moment, upon successful login, menu.tt2 will be called. At work we do this with http://tr.im/j75v . If an action requires the user to be authenticated,
Re: [Catalyst] What's the best way to exclude static requests from needing user to log in?
hi,John, Good arvo. Thanks for the comments. My replies are as per below: Quoting John Romkey rom...@apocalypse.org: On Apr 18, 2009, at 8:06 PM, kakim...@tpg.com.au wrote: hi, all what's the best way to exclude static requests from needing the user to log in? The best way to exclude static requests from needing the user to log in is to not run them through Catalyst at all. Configure your web server so that static files are served directly by the server. This will greatly improve performance as well as simplify your Catalyst code. K. akimoto: You have a very good point and I think I will consider this. Unless that's not what you mean by static. If you by static you still mean some dynamic content, I would strongly avoid putting all the logic for access control in Root's auto method. Root's auto method then knows too much about the implementation details of each controller. Instead put the access control logic where it belongs - with the stuff it's controlling access to. - john romkey http://www.romkey.com/ K. akimoto: this is interesting. All requests would have to go through Root-auto before any other actions in controllers Hence, whilst the Root-auto method does hold implementation details of all controllers in the application, it certainly makes future maintaince of the application ( in terms of controlling all controller access ) easier because the configuration is found in one spot rather than all across the many controllers. Is doing so a bad practice? I would really like to hear some good discussions here.. Thank you again, John :) K. akimoto ___ 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/
[Catalyst] upon successful login, how do i get redirect users back to the page they wanted to access previously?
hi, everybody, Take this scenario: a user who has yet to login tries to access a path that is only for logged in users. Assume it is www.lginsurance.com.au/subcriptions/add. Hence, in my index.tt2, upon displaying a message indicating that the current user has yet to log in, I also display the log in form. - extract from index.tt2 - starts -- [% IF Catalyst.user_exists %] [% PROCESS menu.tt2 %] [% ELSE %] User has not logged in. [% PROCESS login.tt2 %] [% END %] - extract from index.tt2 - ends -- upon successful login, how do i get redirect users back to the page they wanted to access previously (which is www.lginsurance.com.au/subcriptions/add)? At the moment, upon successful login, menu.tt2 will be called. Thank you. K. akimoto ___ 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/
Re: [Catalyst] PAR file - can't build it . Prolly documentation is out of date?
Quoting Tomas Doran bobtf...@bobtfish.net: On 16 Apr 2009, at 06:57, kakim...@tpg.com.au wrote: Hi there, I refered to http://catalyst.infogami.com/cookbook/par. I can't seem to find the line, catalyst_files();. I don't know what you're talking about - as that phrase isn't mentioned anywhere in that document. K. akimoto: It is there. Please look under the title, Add these lines to Makefile.PL (below catalyst_files();). How do you guys get your PAR files made? We don't. PAR isn't a recommended deployment method these days. K. akimoto: Really?? i would really suggest someone to the mention of it out of the Catalyst cookbook in http://search.cpan.org/~hkclark/Catalyst-Manual-5.7020/lib/Catalyst/Manual/Cookbook.pod#Quick_deployment:_Building_PAR_Packages. I assume that par files will get the new server which I want to install my application to launch CPAN shell to install the extra modules it needs? No. This idea of a PAR file is that it contains all the dependencies already. The recommended solution is to build a local::lib with all your dependencies in, and keep this in revision control / ship it with the rest of your application. k.akimoto: I like this idea! Damn, should have considered this earlier. Ah well, i will save it for my next projects. Cheers t0m ___ 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/ ___ 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/
Re: [Catalyst] PAR file - can't build it . Prolly documentation is out of date?
Tomas, I must have missed the memo about PAR not being recommend. Is there a discussion thread I can read about it? Thank you, James! Yes, I would like to read more about the discussion thread (if it exists). Interesting.. K. akimoto ___ 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/
Re: [Catalyst] Keep getting checksum mismatch problems each time I regenerate my schema files
Hello, John thank you for your response. Quoting John Romkey rom...@apocalypse.org: On Apr 16, 2009, at 12:41 AM, kakim...@tpg.com.au wrote: I keep getting a checksum mismatch problems each time I regenerate my schema files. What's the most common fault and solution? I really don't know why.. Look in the schema file. You see this line? # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum: it means that you modified that line or something above it... Yes I do see the line. If the way the check is to be done is so stringent (ie. permissions on the files it touches or even new lines, surely, the makers of this package could come up with somethign better. I don't have the same issue when using Ruby on Rails' Active Records). As per the source code, /usr/local/share/perl/5.8.9/DBIx/Class/Schema/Loader/Base.pm , here's what I did to silence it temporarily. how i solved the checksum mismatch problem temporarily sub _get_custom_content { my ($self, $class, $filename) = @_; return if ! -f $filename; open(my $fh, '', $filename) or croak Cannot open '$filename' for reading: $!; my $mark_re = qr{^(# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:)([A-Za-z0-9/+]{22})\n}; my $found = 0; my $buffer = ''; while($fh) { if(!$found /$mark_re/) { print qq| found is $found...\n|; $found = 1; my $one = $1; $buffer .= $one; my $two = $2; #print qq| buffer is $buffer\n|; #print qq| Two is $two\n|; #print qq| one is $one...\n|; #print qq| checksum base 64 is '| . Digest::MD5::md5_base64($buffer) . qq|'\n|; #croak Checksum mismatch in '$filename' #if Digest::MD5::md5_base64($buffer) ne $two; $buffer = ''; } else { $buffer .= $_; } } croak Cannot not overwrite '$filename' without 'really_erase_my_files', . it does not appear to have been generated by Loader if !$found; return $buffer; } ___ 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/
RE: [Catalyst] Catalyst-Ajax-Mochikit - followed tute but am stuck. Cannot show values in view(webpage)
Hello, Ali, Thank you very much for coming back to this post. At the moment, I have just used a simple div id=price/ tag and it works great. Once I do more work on AJAX, I will put your suggestions in. K . akimoto Quoting Mesdaq, Ali ames...@websense.com: Hello, I am the one who wrote that article sorry if it wasnt clear enough to help you out here. Looking at the code you pasted I see a few places where I think the issue might be. In your subscriptions_quote.js file you dont have the price element defined like in my example. What you need is a reference to the element and you dont have one. So add something like var price = getElement('price'); right under your var check_price = getElement('check_price');. That will give you a reference to that element that you will need when you call replaceChildNodes later. Also a minor change you could add is change p_txt = P({'style':'display:none'}, resp.data.price); to var p_txt = P({'style':'display:none'}, resp.data.price);. One of the debugging steps you can take with firebug is to actually watch the DOM get updated. If you right click somewhere on the page thats close to where your price data will be displayed you can select Inspect Element then navigate to where the element will be created. Its possible that the element gets added to the DOM but you have an issue with the appear() function so it never displays even though its been inserted with the replaceChildNodes() that has happened to me many times before. Also after you do var p_txt = P({'style':'display:none'}, resp.data.price); I would do a console.log(p_txt); Just to dump that DOM element and make sure its being created correctly with the correct data as well as the correct attributes. You might even want to not have it be set to display none so that you can take the whole visual affect issues out of the debugging. Please let me know if this helps I am very interested in making sure the issue is resolved based on the instructions I gave in the tutorial instead of other work arounds. Thanks, -- Ali Mesdaq (CISSP, GIAC-GREM) Sr. Security Researcher Websense Security Labs http://www.WebsenseSecurityLabs.com -- -Original Message- From: kakim...@tpg.com.au [mailto:kakim...@tpg.com.au] Sent: Sunday, April 12, 2009 8:50 PM To: The elegant MVC web framework Subject: [Catalyst] Catalyst-Ajax-Mochikit - followed tute but am stuck. Cannot show values in view(webpage) hi everybody :) Referring to http://www.catalystframework.org/calendar/2008/24, I have made a small change to my app and tried developing it with AJAX. What's successful: = *) managed to make a call to my controller - i put in a $c-log-debug( ... ) statement and saw that come up fine What I have done to check: = *) Used Firebug on firefox to check the returned object. Looks good in that it has = 1) 'status'='Successful' 2) 'data' hash ref which even has 'price' = 'the value i expected'. How do I actually get the value (which is the 'price' attribute to display)? Point of problem: addCallBack method in my javascript file. Where an I stuck: = *) can't seem to display values returned from JSON be it via span or a html table. All I wanted to do was to get my controller to pass out a 'price' value. here are my files: the only template, 'form.tt2' -- span class=error id=error ul [% FOREACH error IN errors %] li[% error %]/li [% END %] /ul /span hr/ [% END %] form method=post action=[% target_action %] id=agent_subscription_form name=agent_subscription_form table border=0 cellspacing=3 tr td valign=top insurance duration: /td td valign=top input type=text id=duration name = duration/ /td /tr tr td valign=top Price /td td valign=top span class=price id=price/span input type=button id=check_price name=check_price value=check
[Catalyst] Keep getting checksum mismatch problems each time I regenerate my schema files
Hello all, I keep getting a checksum mismatch problems each time I regenerate my schema files. What's the most common fault and solution? I really don't know why.. For reference, my command was: script/myapp_create.pl model myAppDB DBIC::Schema gozila::Schema create=static dbi:Pg:dbname=myDatabaseForTheApplication my-user my-password I do check my files into GIT after generating them each time. Could this be the cause? Anyone with the same issue? thank you. k. akimoto ___ 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/
Re: [Catalyst] Catalyst-Ajax-Mochikit - followed tute but am stuck. Cannot show values in view(webpage)
Hello, Matthew, Thank you for your reply. No there was no mistake. It was just that I was trying to make it work by trying to put the value of price into the span element and the dynamic html table generation (as per the tute). 1) span element - uses p_txt = P({'style':'display:none'}, resp.data.price); ( i have even tried using resp.data.price.value to no success) 2) html table element, td within a tr - var td_price = TD(null, resp.data.price.value); Quoting Matthew Topper toppe...@gmail.com: On Mon, 13 Apr 2009 13:50:19 +1000 kakim...@tpg.com.au wrote: hi everybody :) Referring to http://www.catalystframework.org/calendar/2008/24, I have made a small change to my app and tried developing it with AJAX. What's successful: = *) managed to make a call to my controller - i put in a $c-log-debug( ... ) statement and saw that come up fine What I have done to check: = *) Used Firebug on firefox to check the returned object. Looks good in that it has = 1) 'status'='Successful' 2) 'data' hash ref which even has 'price' = 'the value i expected'. How do I actually get the value (which is the 'price' attribute to display)? Point of problem: addCallBack method in my javascript file. Where an I stuck: = *) can't seem to display values returned from JSON be it via span or a html table. All I wanted to do was to get my controller to pass out a 'price' value. here are my files: the only template, 'form.tt2' -- span class=error id=error ul [% FOREACH error IN errors %] li[% error %]/li [% END %] /ul /span hr/ [% END %] form method=post action=[% target_action %] id=agent_subscription_form name=agent_subscription_form table border=0 cellspacing=3 tr td valign=top insurance duration: /td td valign=top input type=text id=duration name = duration/ /td /tr tr td valign=top Price /td td valign=top span class=price id=price/span input type=button id=check_price name=check_price value=check price/ script type=text/javascript src=[% Catalyst.uri_for('/js/subscriptions_quote.js') %]/script /td /tr /table /form the javascript, subscriptions_quote.js -- //Creates MochiKit logging pane. Remove true if you want it popped out in its own window createLoggingPane(true); var message = getElement('message'); var error = getElement('error'); var duration = getElement('duration'); var check_price = getElement('check_price'); connect ( 'check_price', 'onclick', function () { log(I have been clicked and here are my values:); log(Duration: , duration.value); //Creating our params object to hold our arguments that we will be posting var params = { export_to: export_to.value, duration: duration.value, agent_code: agent_code.value }; //Calling MochiKit's doXHR which makes XMLHttpRequests painless //'/usersubscriptions/get_price', var d = doXHR ( '/users/subscriptions/check_price', { 'method': 'POST', 'sendContent': queryString(params), 'headers': {'Content-Type':'application/x-www-form-urlencoded'} } ); //Creating a callback on success to process our json response d.addCallback ( function (req) { //eval'ing and assigning our returned json data to resp variable var resp = evalJSONRequest(req); //logging to firebug as an example comment out if not installed
Re: [Catalyst] Catalyst-Ajax-Mochikit - followed tute but am stuck. Cannot show values in view(webpage)
hello, Peter, Good evening. Thank you for the response. Yeah, log(resp.data.price); prints out the value which I was expecting. Hence, I was expecting the line, p_txt = P({'style':'display:none'}, resp.data.price); to have worked. alas, your recommendation of p_txt = P({'style':'display:none'}, resp.data.price.value); failed too :( anyone?? thank you:) Quoting Peter Flanigan p...@roxsoft.co.uk: kakim...@tpg.com.au wrote: How do I actually get the value (which is the 'price' attribute to display)? Point of problem: addCallBack method in my javascript file. //Creating a callback on success to process our json response d.addCallback ( function (req) { //elements consult mochikit docs for full details var td_price = TD(null, resp.data.price.value); // Im stuck here!!! Don't know why the freakin' value won't show :( p_txt = P({'style':'display:none'}, resp.data.price); replaceChildNodes(price, [p_txt]); Am not familiar with Mochikit, but from context should that be p_txt = P({'style':'display:none'}, resp.data.price.value); ^^^ -- Regards ___ 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/ ___ 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/
Re: [Catalyst] Catalyst-Ajax-Mochikit - followed tute but am stuck. Cannot show values in view(webpage)
hello, Gordon :) thank you for your response :) i have tried what you recommended me and yes, it works just fine. thank you, everybody! K. akimoto Quoting Gordon Yeong anexi...@gmail.com: hmmm Haven't done much mochikit but if you're wantign to just update a single element, consider using a DIV tag element in the html file and from the javascript file you have made, update the element (based on the ID assigned to the DIV tag element earlier) ? Taking your code into consideration, in your javascript file, just add this function, * Start ** function updatepage(str) { document.getElementById(price).innerHTML = str; } * End ** and where the request is successful, just make a call to it : * Start ** //Checking to see we have a successful response in our returned data if (resp.status == 'Successful') { log('the Response has status of successful...'); log('mokkie Response has status of successful...'); log(resp.data.price); *updatepage(resp.data.price); Over here :)* } else { log('Response has status of NON successful'); //calling our partial function u_message(resp.status); //getting error reason and txt and updating user for (i in resp.error) { log('Error is:',i); log('Reason is:',resp.error[i]); u_error(i+': '+resp.error.i); } } * End ** Hope it helps:) Regards, Gordon Yeong 2009/4/13 kakim...@tpg.com.au hello, Peter, Good evening. Thank you for the response. Yeah, log(resp.data.price); prints out the value which I was expecting. Hence, I was expecting the line, p_txt = P({'style':'display:none'}, resp.data.price); to have worked. alas, your recommendation of p_txt = P({'style':'display:none'}, resp.data.price.value); failed too :( anyone?? thank you:) Quoting Peter Flanigan p...@roxsoft.co.uk: kakim...@tpg.com.au wrote: How do I actually get the value (which is the 'price' attribute to display)? Point of problem: addCallBack method in my javascript file. //Creating a callback on success to process our json response d.addCallback ( function (req) { //elements consult mochikit docs for full details var td_price = TD(null, resp.data.price.value); // Im stuck here!!! Don't know why the freakin' value won't show :( p_txt = P({'style':'display:none'}, resp.data.price); replaceChildNodes(price, [p_txt]); Am not familiar with Mochikit, but from context should that be p_txt = P({'style':'display:none'}, resp.data.price.value); ^^^ -- Regards ___ 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/ ___ 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/ ___ 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/
[Catalyst] Catalyst-Ajax-Mochikit - followed tute but am stuck. Cannot show values in view(webpage)
hi everybody :) Referring to http://www.catalystframework.org/calendar/2008/24, I have made a small change to my app and tried developing it with AJAX. What's successful: = *) managed to make a call to my controller - i put in a $c-log-debug( ... ) statement and saw that come up fine What I have done to check: = *) Used Firebug on firefox to check the returned object. Looks good in that it has = 1) 'status'='Successful' 2) 'data' hash ref which even has 'price' = 'the value i expected'. How do I actually get the value (which is the 'price' attribute to display)? Point of problem: addCallBack method in my javascript file. Where an I stuck: = *) can't seem to display values returned from JSON be it via span or a html table. All I wanted to do was to get my controller to pass out a 'price' value. here are my files: the only template, 'form.tt2' -- span class=error id=error ul [% FOREACH error IN errors %] li[% error %]/li [% END %] /ul /span hr/ [% END %] form method=post action=[% target_action %] id=agent_subscription_form name=agent_subscription_form table border=0 cellspacing=3 tr td valign=top insurance duration: /td td valign=top input type=text id=duration name = duration/ /td /tr tr td valign=top Price /td td valign=top span class=price id=price/span input type=button id=check_price name=check_price value=check price/ script type=text/javascript src=[% Catalyst.uri_for('/js/subscriptions_quote.js') %]/script /td /tr /table /form the javascript, subscriptions_quote.js -- //Creates MochiKit logging pane. Remove true if you want it popped out in its own window createLoggingPane(true); var message = getElement('message'); var error = getElement('error'); var duration = getElement('duration'); var check_price = getElement('check_price'); connect ( 'check_price', 'onclick', function () { log(I have been clicked and here are my values:); log(Duration: , duration.value); //Creating our params object to hold our arguments that we will be posting var params = { export_to: export_to.value, duration: duration.value, agent_code: agent_code.value }; //Calling MochiKit's doXHR which makes XMLHttpRequests painless //'/usersubscriptions/get_price', var d = doXHR ( '/users/subscriptions/check_price', { 'method': 'POST', 'sendContent': queryString(params), 'headers': {'Content-Type':'application/x-www-form-urlencoded'} } ); //Creating a callback on success to process our json response d.addCallback ( function (req) { //eval'ing and assigning our returned json data to resp variable var resp = evalJSONRequest(req); //logging to firebug as an example comment out if not installed //console.log(resp); //Checking to see we have a successful response in our returned data if (resp.status == 'Successful') { log('the Response has status of successful...'); //creating dom elements. first arg pass is named args for attributes //second arg passed is data inside element. can be string or array of more //elements consult mochikit docs for full details var td_price = TD(null, resp.data.price.value); log(resp.data.price); //calling our partial function u_message(resp.status); //Calling MochiKit's appendChildNodes() to only the fly update the
Re: [Catalyst] Application stallling problem
Hello, Kieren, Good morning. Thank you for your help. I have the templates below. My apologies if it is too long but I really need some pointers here. The main file, home/kakimoto/projects/myApp/root/src/index.tt2 decides if we show the general static content if the user is not logged in. If the user is logged in, we display the menu. My problem happens site wide be it the user is logged in or not. For example, clicking on either of the static page links, Test Drive, About us and so forth (within 10 seconds) causes the myapp_server.pl screen in my terminal to not do anything (ie it freezes up). is it true that myapp_server.pl is not good enough to handle requests that are established within 10 seconds or less? Or even double clicks? Thank you for your help. Any comment would be appreaciated. 1) /home/kakimoto/projects/myApp/root/src/index.tt2 = [% IF Catalyst.user_exists %] [% PROCESS menu.tt2 %] [% ELSE %] !-- User has not logged in. -- !-- this section displays the general site page (ie the general contents) -- [% END %] 2) /home/kakimoto/projects/myApp/root/src/sidebar.tt2 !-- Sidebar code [start] -- a href=/menu class=sidebar Main /a br/ a href=/users/profile class=sidebar Profile /a br/ a href=/users/subscriptions class=sidebar Subscriptions /a br/ a href=/listings/search class=sidebar Search Listings /a br/ a href=/users/reporting class=sidebar Reporting /a br/ a href=/users/export_logs class=sidebar Export logs /a !-- Sidebar code [end] -- 3) /home/kakimoto/projects/myApp/root/src/agents/create.tt2 [% USE Dumper(Indent=1) -%] [% META title = 'Sign up' %] !-- Load agent form [start] -- h1 [% page_title %] /h1 [% IF signup_success and message %] div id=message [% message %] /div [% ELSE %] [% # target_action = Catalyst.uri_for('/sign_up'); PROCESS 'agents/form.tt2'; %] [% END %] !-- Load agent form [end] -- 4) /home/kakimoto/projects/myApp/root/src/agents/form.tt2 [% USE Dumper(Indent=1) -%] [% META title = 'Sign up/agent profile' %] [% element_requires_validation = 'font id=requires_validation*/font' %] [% IF message %] div id=message [% message %] /div [% END %] pre [% #Dumper.dump(errors) %] /prE [% IF errors %] br/ div id=error ul [% FOREACH error IN errors %] li[% error %]/li [% END %] /ul /div hr/ [% END %] form method=post action=[% target_action %] id=agent_profile_form name=agent_profile_form table border=0 cellspacing=3 [% IF sign_up %] tr td valign=top h2 Login Credentials/h2 [% PROCESS agents/login_credentials.tt2 %] /td /tr [% END %] tr td valign=top h2Company/h2 [% PROCESS agents/company_details.tt2 %] /td /tr tr td valign=top table tr td h2Address/h2
Re: [Catalyst] Application stallling problem
hello , everyone :) good morning. Happy eAster! any more ideas? thank you Quoting kakim...@tpg.com.au: Hello, Kieren, thank you for your feedback. 1) CGI Template Toolkit plugin - not using it I do not think that I am using the CGI Template Toolkit plugin. I have only been using Template Toolkit as prescribed in the Catalyst tutorials. in my file, /myAppl/lib/myApp/View/HTML.pm, I have the line, TEMPLATE_EXTENSION = '.tt2' May I ask on what sort of CGI Template Toolkit plugin are you referring to specifically? 2) Currently having my own ubuntu virtual server to deploy my application. - Any good recommendations? - Would using myapp_server.pl cut for an application which has say 50 users logged in at the same time? Please pardon my lack of knowledge for I am only a developer and have little experience in the systems administation and tuning sector. Thank you, all. Quoting Kieren Diment kie...@diment.org: Are you using the CGI Template Toolkit plugin thingy? Don't. This will cause your problem as described. If not you've given us insufficient information Fastcgi is easier to setup on shared hosting, and has some advantages. CATALYST_ENGINE=HTTP::Prefork script/myapp_server.pl is pretty simple and can be reverse proxied pretty easily. Install C::E::HTTP::Prefork from CPAN and give it a shot... On 09/04/2009, at 11:14 AM, kakim...@tpg.com.au wrote: hello good morning. The page which I access at first doesn't require any database request. It's just pretty much a page that's generated by template toolkit and that's it. On the terminal which I am running the myapp_server.pl script, it seems to stall and not do anything when i put in another url path into the webbrowser and hit enter. Example: 1) URL, www.lginsurance.com/signup is accessed 2) URL, www.lginsurance.com/signup is accessed again by highlighting the url on the web browser and hitting enter -- notice that on the terminal screen, the last line is HTML- process along with the time taken and stalls there Is this a problem you guys have? for production deployment, do many of you run myapp_server.pl or myapp_fastcgi.pl? Any comments please? thank you K. akimoto ___ 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/ ___ 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/
Re: [Catalyst] Application stallling problem
hello good morning. The page which I access at first doesn't require any database request. It's just pretty much a page that's generated by template toolkit and that's it. On the terminal which I am running the myapp_server.pl script, it seems to stall and not do anything when i put in another url path into the webbrowser and hit enter. Example: 1) URL, www.lginsurance.com/signup is accessed 2) URL, www.lginsurance.com/signup is accessed again by highlighting the url on the web browser and hitting enter -- notice that on the terminal screen, the last line is HTML-process along with the time taken and stalls there Is this a problem you guys have? for production deployment, do many of you run myapp_server.pl or myapp_fastcgi.pl? Any comments please? thank you K. akimoto Quoting Tomas Doran bobtf...@bobtfish.net: kakim...@tpg.com.au wrote: sorry, guys, some bad character encodings from my mail client. Here's the mail again: Any ideas?? Not sure, but I think its something between the server you're using and the browser - if you're getting the request table, then as far as the Catalyst server is aware, then it has passed a page to your browser, and your browser hasn't requested another one.. Probably trying to use tcpdump or a capturing proxy (parosproxy.org) to try and take apart the requests/responses to work out whats going on would be helpful? Cheers t0m ___ 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/ ___ 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/
Re: [Catalyst] Application stallling problem
Hello, Kieren, thank you for your feedback. 1) CGI Template Toolkit plugin - not using it I do not think that I am using the CGI Template Toolkit plugin. I have only been using Template Toolkit as prescribed in the Catalyst tutorials. in my file, /myAppl/lib/myApp/View/HTML.pm, I have the line, TEMPLATE_EXTENSION = '.tt2' May I ask on what sort of CGI Template Toolkit plugin are you referring to specifically? 2) Currently having my own ubuntu virtual server to deploy my application. - Any good recommendations? - Would using myapp_server.pl cut for an application which has say 50 users logged in at the same time? Please pardon my lack of knowledge for I am only a developer and have little experience in the systems administation and tuning sector. Thank you, all. Quoting Kieren Diment kie...@diment.org: Are you using the CGI Template Toolkit plugin thingy? Don't. This will cause your problem as described. If not you've given us insufficient information Fastcgi is easier to setup on shared hosting, and has some advantages. CATALYST_ENGINE=HTTP::Prefork script/myapp_server.pl is pretty simple and can be reverse proxied pretty easily. Install C::E::HTTP::Prefork from CPAN and give it a shot... On 09/04/2009, at 11:14 AM, kakim...@tpg.com.au wrote: hello good morning. The page which I access at first doesn't require any database request. It's just pretty much a page that's generated by template toolkit and that's it. On the terminal which I am running the myapp_server.pl script, it seems to stall and not do anything when i put in another url path into the webbrowser and hit enter. Example: 1) URL, www.lginsurance.com/signup is accessed 2) URL, www.lginsurance.com/signup is accessed again by highlighting the url on the web browser and hitting enter -- notice that on the terminal screen, the last line is HTML- process along with the time taken and stalls there Is this a problem you guys have? for production deployment, do many of you run myapp_server.pl or myapp_fastcgi.pl? Any comments please? thank you K. akimoto ___ 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/
[Catalyst] Issue with Catalyst:Can't locate object method get_user via package Catalyst::Plugin::Authentication::Store::DBIC
When was http://search.cpan.org/~hkclark/Catalyst-Manual-5.7020/lib/Catalyst/Manual/Tutorial/Authentication.pod; updated? Does it reflect the latest modules? Please revert. Kieren Diment diment at gmail.com Thu May 15 14:13:12 BST 2008 * Previous message: [Catalyst] Issue with Catalyst:Can't locate object method get_user via package Catalyst::Plugin::Authentication::Store::DBIC * Next message: [Catalyst] uri_for() doesn't encode to utf8 first argument * Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] On 15 May 2008, at 08:08, kakimoto at tpg.com.au wrote: [error] Caught exception in gozila::Controller::Login- index Can't locate object method get_user via package Catalyst::Plugin::Authentication::Store::DBIC at /Library/Perl/5.8.8/Catalyst/Authentication/Realm.pm line 85. I have tried looking at the source codes of the packages indicated in the error, reinstalled the packages via perl -MCPAN -eshell and it still fails. Have a look at http://dev.catalyst.perl.org/repos/Catalyst/trunk/ examples/NewAuthApp which is a simple authentication application I wrote against the new Auth API. The tutorial uses the old API and needs to be updated. ___ 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/
[Catalyst] Custom constraint subroutines no getting form value using Catalyst::Plugin::FormValidator
Hi, guys, I have been trying to create some custom constraints for my form attributes. I use Catalyst::Plugin::FormValidator when I call my custom subroutine that handles a custom constraint, I notice it will not get the attribute value. I have looked up the docs for 1) Data::FormValidator::Constraints 2) Catalyst::Plugin::FormValidator and tutorial (Data::FormValidator::Tutorial ) and nothing seems to help. Looking at the tutorial (http://search.cpan.org/~purdy/Data-FormValidator-Tutorial-1.61/lib/Data/FormValidator/Tutorial.pm), I decided to build my own constraint subroutines. Here's what I refered to in the tute: --- TUTE Extract Start ... 'email' = \my_domain_email(), ... sub my_domain_email { ... } --- TUTE Extract End And this is what I implemented: --- MyApp/Controller/User.pm Extract Start -- sub _get_validation_profile { my $required = [ qq{lc_abn}, qq{lc_company_name}, qq{mc_telephone}, qq{add_postcode}, qq{add_state}, qq{add_street}, qq{add_street_number}, qq{add_suburb}, qq{ba_postcode}, qq{ba_state}, qq{ba_street}, qq{ba_street_number}, qq{ba_suburb}, qq{lc_login_id}, qq{lc_password}, ]; my $optional = [ qq{mc_email}, qq{mc_first_name}, qq{mc_last_name}, qq{mc_mobile}, ]; my $defaults = { qq{add_country} = 'Australia', qq{ba_country} = 'Australia', }; my $constraints= { qq{mc_email} = email(), qq{lc_abn} = FV_min_length(5), qq{mc_telephone} = FV_min_length(9), qq{add_postcode} =gozila::Controller::Shared-FV_postcode, qq{add_state} = gozila::Controller::Shared-FV_state, qq{add_street} = FV_min_length(5), qq{add_street_number} = sub { my $elem = shift; return ( $elem =~ m{\w+} ? 1 : 0 ); }, qq{add_suburb} = FV_min_length(2), qq{ba_postcode} = gozila::Controller::Shared-FV_postcode, qq{ba_state} = gozila::Controller::Shared-FV_state, qq{ba_street} = FV_min_length(5), qq{ba_street_number} = sub { my $elem = shift; return ( $elem =~ m{\w+} ? 1 : 0 ); }, qq{ba_suburb} = FV_min_length(2), qq{lc_login_id} = FV_min_length(5), qq{lc_password} = FV_min_length(5), }; return { 'required' = $required, 'optional' = $optional, 'defaults' = $defaults, 'constraints' = $constraints, }; } --- MyApp/Controller/User.pm Extract End --- MyApp/Controller/Shared.pm Extract Start sub FV_postcode { my ($self, $given_postcode) = @_; Line: 100return ( $given_postcode = 200 ? 1 : 0 ); } sub FV_state { my ($self, $given_state) = @_; Line: 106return ( $given_state =~ m{^(VIC|ACT|NSW|TAS|WA|SA|NT|QLD)$}smx ? 1 : 0 ); } --- MyApp/Controller/Shared.pm Extract End -- the fault here is that I get the error listed below which means that the subroutines which I have defined are not getting anything... Use of uninitialized value in numeric ge (=) at /home/kakimoto/projects/myApp/t/../lib/myApp/Controller/Shared.pm line 100. Use of uninitialized value in pattern match (m//) at /home/kakimoto/projects/myApp/t/../lib/myApp/Controller/Shared.pm line 106. Use of uninitialized value in numeric ge (=) at /home/kakimoto/projects/myApp/t/../lib/myApp/Controller/Shared.pm line 100. Use of uninitialized value in pattern match (m//) at /home/kakimoto/projects/myApp/t/../lib/myApp/Controller/Shared.pm line 106. Any ideas? Thank you:) ___ 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/
Re: [Catalyst] How to detect if the current form request is a post?
Read my response. I said 1) POST is the prefered method 2) using GET for a content sensitive site like an online banking site is bad. I m sure you would not want to have people book marking your session ID , or worst, the user credentials used to login and access certain pages which are private to the authorised user. For things like ebay which will have the ID of a given item, it's alright to use GET but the problem is that you have to watch the number of characters you have in the url request. K. akimoto Quoting kakim...@tpg.com.au: huh? I woudlnt' use GET unless it's for something very simple such as a REST request or a way to learn CGI. I certainly dont want people book marking a url with parameters especially if i ran a banking transaction website. Quoting Octavian Rasnita orasn...@gmail.com: From: kakim...@tpg.com.au Thank you:) Yep, and I am aware of GET as a form request method and yes, i hate it. Why? I knew that it should be the prefered method for the forms that don't change anything on the server, like a search form. Isn't this true? I ask this because I've seen many search forms that use POST and it is impossible to bookmark the found pages, or also seen forms that use Javascript with POST. Octavian ___ 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/ ___ 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/ ___ 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/
Re: [Catalyst] How to detect if the current form request is a post?
fromDavid Dorward da...@dorward.me.uk kakim...@tpg.com.au wrote: Read my response. I said 1) POST is the prefered method Not according to the standard. Everything has its place. -- True . That's why I used the word, prefered and not compulsory LOL 2) using GET for a content sensitive site like an online banking site is bad. I m sure you would not want to have people book marking your session ID , or worst, the user credentials used to login and access certain pages which are private to the authorised user. The session id shouldn't be in the URI, that's what cookies are for. -- It's just an example. Authentication credentials are an exception to the normal guideline. But everything else? Why shouldn't I bookmark the latest transactions page of my credit card account? Or the Give me a form so I can pay my electricity bill page? -- So, tell me, would you like to allow people to bookmark transaction ID numbers or attributes which are not permanent (ie will last until a transaction is done)? Fact is, guidelines are there for best practices but rules are meant to be bent when we encounter different problems/scenarios. Another factor is the business rules. If they business doesn't want its subscribers (for what ever business acumen/reason or perhaps to discount future maintenance of having to put in redirects when they decommission or rename certain URIs) to have a bookmark for them to achieve certain things (ie. look at their electricity bills), then POST would be the better pick. Also, when POST is used , the URL on the url address bar of the browser remains clean without the extra params. Again, that's just my opinion and how I observed different organisations do things. No right or wrong - just common sense. Good night. K. akimoto ___ 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/
Re: [Catalyst] How to detect if the current form request is a post?
Quoting Octavian Rasnita orasn...@gmail.com: From: kakim...@tpg.com.au -- So, tell me, would you like to allow people to bookmark transaction ID numbers or attributes which are not permanent (ie will last until a transaction is done)? Yes. If the users want to do that, it is very good to let them do it, and the next time when they'll come, they will see that they can't access that page without re-logging again, and we might also get the original URI that was requested, and after they log in, they could be forwarded to the wanted URL. Fact is, guidelines are there for best practices but rules are meant to be bent when we encounter different problems/scenarios. Another factor is the business rules. If they business doesn't want its subscribers (for what ever business acumen/reason or perhaps to discount future maintenance of having to put in redirects when they decommission or rename certain URIs) to have a bookmark for them to achieve certain things (ie. look at their electricity bills), then POST would be the better pick. Also, when POST is used , the URL on the url address bar of the browser remains clean without the extra params. Why does this matter? Don't allow the user to bookmark a page because the URL that will be accessed doesn't look nice? -- No. It's for usability and that's somethign that a lot of good programmers do not have yet and should start paying more attention to. I am reinventing myself by putting in points of usability. Having a url that's clean brings it closer to keeping it all simple. That's me. Do it however way you want but i have learnt enough lessons along the way to justify what I think is good for production. Again, that's just my opinion and how I observed different organisations do things. No right or wrong - just common sense. That common sense is bad sense, and this is the main reason I put that question. That common sense of not being flexible to situations/scenarios where requirements differ? Bravo. I'll halt from' investing more time on this thread. Cheers. ___ 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/
Re: [Catalyst] Re: How to detect if the current form request is a post?
Interesting. I will give it some more thought. Thanks :) Quoting kevin montuori montu...@gmail.com: DD == David Dorward da...@dorward.me.uk writes: DD Limiting the side effects of laziness and bad practices with other bad DD practices ... well, that's an interesting argument, I'll give you that. that's funny. all other things being equal, since catalyst controllers can be method agnostic there's no reason to limit the application's functionality by only allowing POST or whatever. even in circumstances where the HTML should direct the browser to POST, accepting GET is often very handy. using openssl s_client to debug code behind SSL encrypted connections, for instance. (that's not to imply that it's not possible with POST, but it's less trivial. particularly at 3 am.) i think the maxim is: be strict in what you send and generous in what you receive. applications adhering to this philosophy tend to last. k. -- kevin montuori montu...@gmail.com ___ 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/ ___ 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/
[Catalyst] How to detect if the current form request is a post?
hi all In Ruby we can detect if the current form's request is a post or not. def controller_action if request.post? # Process post data as the user has submitted the form. else # Display form end end Looking at Catalyst::Request (http://search.cpan.org/~mramberg/Catalyst-Runtime-5.71001/lib/Catalyst/Request.pm#$req-%3Eprotocol), I found $req-method. The description says, Contains the request method (GET, POST, HEAD, etc). So, in Catalyst, would it be sufficient for me to do something like: sub controller_action : Path('registration') { if (($c-request-method eq 'POST') or ($c-request-method eq 'GET')) { # Process post data as the user has submitted the form. } else { # Display form } return 1; } Comments? Thanks ___ 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/
Re: [Catalyst] How to detect if the current form request is a post?
Thank you:) Yep, and I am aware of GET as a form request method and yes, i hate it. haha K. akimoto Quoting J. Shirley jshir...@gmail.com: On Tue, Mar 31, 2009 at 4:01 PM, kakim...@tpg.com.au wrote: hi all In Ruby we can detect if the current form's request is a post or not. def controller_action if request.post? # Process post data as the user has submitted the form. else # Display form end end Looking at Catalyst::Request ( http://search.cpan.org/~mramberg/Catalyst-Runtime-5.71001/lib/Catalyst/Request.pm#$req-%3Eprotocolhttp://search.cpan.org/%7Emramberg/Catalyst-Runtime-5.71001/lib/Catalyst/Request.pm#$req-%3Eprotocol ), I found $req-method. The description says, Contains the request method (GET, POST, HEAD, etc). So, in Catalyst, would it be sufficient for me to do something like: sub controller_action : Path('registration') { if (($c-request-method eq 'POST') or ($c-request-method eq 'GET')) { # Process post data as the user has submitted the form. } else { # Display form } return 1; } Comments? Thanks Yes, as the docs say, that's what it is for :) $c-req-method eq 'POST' will do what you want. You should not do any processing on a GET request, though. It is just bad practice. -J ___ 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/
Re: [Catalyst] Application stallling problem
sorry, guys, some bad character encodings from my mail client. Here's the mail again: hi guys, i have this issue when i click on any url of my site more than once (ie double clicking). When i click more than once, the site stalls and nothing loads (even if it's just a light weight static page that i want to load). Example: 1. i load up www.lginsurance.com 2. all loaded up and nice 3. i now click on about us link which points to www.lginsurance.com/aboutus 4. i then immediately change my mind and want to go to the products page and click on the link, products which points to www.lginsurance.com/products 5. the site stalls and doens't move at the terminal, i observed that HTML::View-process is the last thing that's being called. [debug] GET request for / from 123.243.50.59 [debug] Path is / [debug] Rendering template index.tt2 [debug] Applying HTML page layout wrappers to index.tt2 [info] Request took 0.094246s (10.611/s) .+---. | Action | Time | ++---+ | /auto | 0.000406s | | /default | 0.000129s | | /end | 0.049609s | | - myApp::View::HTML-process| 0.047017s | '+---' Any ideas?? K. akimoto ___ 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/
Re: [Catalyst] Getting strange warning each time a request is made to myApp
hi there Definitely not. What I don't understand is that this error has not surfaced until recently. Really strange. Any idea where to trace? Quoting Greg Matheson drb...@freeshell.org: On Sat, 14 Mar 2009, kakim...@tpg.com.au wrote: - extract START --- [warn] Used regexp fallback for $c-model('myApp::View::HTML'), which found 'myApp::View::HTML=HASH(0x8ef7b50)'. Relying on regexp fallback behavior for component resolution is unreliable and unsafe. You probably meant $c-model('myApp::View::HTML=HASH(0x8ef7b50)') instead of $c-model{'myApp::View::HTML'}, but if you really wanted to search, pass in a regexp as the argument like so: $c-model(qr/myApp::View::HTML/) at /usr/local/lib/perl5/site_perl/5.8.9/Catalyst/Action/RenderView.pm line 56 [debug] Rendering template index.tt2 [debug] Applying HTML page layout wrappers to index.tt2 - extract END --- You're not calling $c-model('Table') instead of $c-model('DB::Table') are you? ___ 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/ ___ 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/