RE: [Catalyst] subclassing model classes
Hi Wallace, Thanks for your reply. I'm using the perl debugger: Class::C3::Componentised::ensure_class_loaded(/home/couchman/catalyst/AntSpec/script/../lib/AntSpec/Schema/Result/Placemark.pm:10): 10: __PACKAGE__-resultset_class('AntSpec::Schema::ResultSet::Placemark'); DB1 n Class::C3::Componentised::ensure_class_loaded(/home/couchman/catalyst/AntSpec/script/../lib/AntSpec/Schema/Result/Placemark.pm:12): 12: 1; DB1 x __PACKAGE__ 0 'AntSpec::Schema::Result::Placemark' DB2 x __PACKAGE__-resultset_class 0 'AntSpec::Schema::ResultSet::Placemark' DB3 c Class::C3::Componentised::ensure_class_loaded(/home/couchman/catalyst/AntSpec/script/../lib/AntSpec/Schema/Result/Vertex.pm:10): 10: __PACKAGE__-resultset_class('AntSpec::Schema::ResultSet::Vertex'); DB3 n Class::C3::Componentised::ensure_class_loaded(/home/couchman/catalyst/AntSpec/script/../lib/AntSpec/Schema/Result/Vertex.pm:12): 12: 1; DB3 x __PACKAGE__ 0 'AntSpec::Schema::Result::Vertex' DB4 x __PACKAGE__-resultset_class 0 'AntSpec::Schema::ResultSet::Vertex' DB5 x AntSpec::Schema::Result::Placemark-resultset_class 0 'AntSpec::Schema::ResultSet::Vertex' DB6 x AntSpec::Schema::Result::Point-resultset_class 0 'AntSpec::Schema::ResultSet::Vertex' Thanks again, Matt. -Original Message- From: Wallace Reis [mailto:wall...@reis.org.br] Sent: 15 December 2009 23:13 To: The elegant MVC web framework Subject: Re: [Catalyst] subclassing model classes On 15/12/2009, at 14:58, matthew couchman (JIC) wrote: I now have a couple of subclasses of Point called Vertex and Placemark. I'm trying to associate them with my new ResultSet subclasses. In MyApp::Schema::Result::Vertex: use base 'MyApp::Schema::Result::Point'; __PACKAGE__-resultset_class('MyApp::Schema::ResultSet::Vertex'); And in MyApp::Schema::Result::Placemark: use base 'MyApp::Schema::Result::Point'; __PACKAGE__-resultset_class('MyApp::Schema::ResultSet::Placemark'); I think __PACKAGE__-resultset_class is calling the parent class MyApp::Schema::Result::Point-resultset_class in both cases so the second call overwrites the first. How do I avoid this? How are you identifying this behaviour? It shouldn't be like that. What does print $schema-source($_)-resultset_class for qw(Vertex Placemark) output? -- wallace reis/wreis Catalyst and DBIx::Class consultancy with a clue Software Engineer and a commit bit: http://shadowcat.co.uk/catalyst/ Shadowcat Systems Limited http://www.shadowcat.co.uk http://www.linkedin.com/in/wallacereis ___ 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] subclassing model classes
DBIx::Class::Helper::SubClass fixes the relationships too! I've spoken about the problem that rels stop working when subclassing a result class in the irc channel but at that time there wasn't a solution for it. Thanks for the hint, I will try it out soon! -- Best regards, Alex Am Mittwoch, den 16.12.2009, 13:42 +0100 schrieb matthew couchman (JIC): I've just discovered DBIx::Class::Helper::SubClass which seems to have done the trick. Thanks again for all your help. -Original Message- From: matthew couchman (JIC) [mailto:matthew.couch...@bbsrc.ac.uk] Sent: 16 December 2009 10:54 To: The elegant MVC web framework Subject: RE: [Catalyst] subclassing model classes Hi Wallace, Thanks for your reply. I'm using the perl debugger: Class::C3::Componentised::ensure_class_loaded(/home/couchman/catalyst/A ntSpec/script/../lib/AntSpec/Schema/Result/Placemark.pm:10): 10: __PACKAGE__- resultset_class('AntSpec::Schema::ResultSet::Placemark'); DB1 n Class::C3::Componentised::ensure_class_loaded(/home/couchman/catalyst/A ntSpec/script/../lib/AntSpec/Schema/Result/Placemark.pm:12): 12: 1; DB1 x __PACKAGE__ 0 'AntSpec::Schema::Result::Placemark' DB2 x __PACKAGE__-resultset_class 0 'AntSpec::Schema::ResultSet::Placemark' DB3 c Class::C3::Componentised::ensure_class_loaded(/home/couchman/catalyst/A ntSpec/script/../lib/AntSpec/Schema/Result/Vertex.pm:10): 10: __PACKAGE__- resultset_class('AntSpec::Schema::ResultSet::Vertex'); DB3 n Class::C3::Componentised::ensure_class_loaded(/home/couchman/catalyst/A ntSpec/script/../lib/AntSpec/Schema/Result/Vertex.pm:12): 12: 1; DB3 x __PACKAGE__ 0 'AntSpec::Schema::Result::Vertex' DB4 x __PACKAGE__-resultset_class 0 'AntSpec::Schema::ResultSet::Vertex' DB5 x AntSpec::Schema::Result::Placemark-resultset_class 0 'AntSpec::Schema::ResultSet::Vertex' DB6 x AntSpec::Schema::Result::Point-resultset_class 0 'AntSpec::Schema::ResultSet::Vertex' Thanks again, Matt. -Original Message- From: Wallace Reis [mailto:wall...@reis.org.br] Sent: 15 December 2009 23:13 To: The elegant MVC web framework Subject: Re: [Catalyst] subclassing model classes On 15/12/2009, at 14:58, matthew couchman (JIC) wrote: I now have a couple of subclasses of Point called Vertex and Placemark. I'm trying to associate them with my new ResultSet subclasses. In MyApp::Schema::Result::Vertex: use base 'MyApp::Schema::Result::Point'; __PACKAGE__-resultset_class('MyApp::Schema::ResultSet::Vertex'); And in MyApp::Schema::Result::Placemark: use base 'MyApp::Schema::Result::Point'; __PACKAGE__- resultset_class('MyApp::Schema::ResultSet::Placemark'); I think __PACKAGE__-resultset_class is calling the parent class MyApp::Schema::Result::Point-resultset_class in both cases so the second call overwrites the first. How do I avoid this? How are you identifying this behaviour? It shouldn't be like that. What does print $schema-source($_)-resultset_class for qw(Vertex Placemark) output? -- wallace reis/wreis Catalyst and DBIx::Class consultancy with a clue Software Engineer and a commit bit: http://shadowcat.co.uk/catalyst/ Shadowcat Systems Limited http://www.shadowcat.co.uk http://www.linkedin.com/in/wallacereis ___ 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/ *** T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien Handelsgericht Wien, FN 79340b *** Notice: This e-mail contains information that is confidential and may be privileged. If you are not the intended recipient, please notify the sender and then delete this e-mail immediately. *** ___ 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] go to chained action
Hello! Having, for example, /controller/*/action handled by /controller/base (1) = /controller/action, how do I write correct go to /controller/argument/action ? just $c-go('/controller/argument/action') does not work. $c-go('/controller/action', [qw(argument)]) does not work as well, while $c-detach('/controller/action', [qw(argument)]) seems to be working. Actually, I'm looking for some kind of internal redirect. Alex. ___ 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] go to chained action
On Wed, 2009-12-16 at 16:18 +0300, Alex Povolotsky wrote: Hello! Having, for example, /controller/*/action handled by /controller/base (1) = /controller/action, how do I write correct go to /controller/argument/action ? just $c-go('/controller/argument/action') does not work. $c-go('/controller/action', [qw(argument)]) does not work as well, while $c-detach('/controller/action', [qw(argument)]) seems to be working. Actually, I'm looking for some kind of internal redirect. If you want an actual redirect you can do something like this: $c-res-redirect($c-uri_for($c-controller('controller')-action_for('action'), [qw(argument)])); $c-detach(); That will work it's way through the chain and should be seamless for the end user when accessing the page. -- o) Derek Wueppelmann (o (D . dwuep...@gmail.com D). ((` http://www.monkeynet.ca ( ) ` ___ 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] Sub-classing Application
I have an existing application Foo. I'd like to create a new application Bar that has very similar actions. What I'm wondering is if there's a way where I could run catalyst.pl Bar to create a new empty application and then tell it to inherit from Foo. That is load_components would load all of Foo's Models, View, Controllers (basically creating in-memory empty sub-classes for each component) and setting up all actions as if they were in Bar. I could then override or add additinal actions as needed to Bar::Controller::Whatever, which would inherit from Foo::Controller::Whatever. Any ideas how to implement something like that? -- Bill Moseley mose...@hank.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] Sub-classing Application
On Wed, Dec 16, 2009 at 8:31 AM, J. Shirley jshir...@gmail.com wrote: The documentation seems quite sparse, but if you look at the source it just essentially does: my $locator = Module::Pluggable::Object-new( search_path = [ map { s/^(?=::)/$class/; $_; } @paths ], %$config ); If you have MyApp-config-{search_extra} = [ 'Foo::Controller', 'Foo::Model' ]; it should DTRT. It almost works, but it sets up actions for both controllers using each controller's class. That is, if I start application Bar and pass in search_extra = [qw/ Foo::Controller / ] then indeed actions from Foo::Controller::* will get added to the application. But, they are added with the Foo:: namespace. that is, that controller is not a parent-class of Bar::Controller::*. It also means I can't easly overide. If I have hello() in both thes controllers: Foo::Controller::Whatever::hello() Bar::Controller::Whatever::hello() I then get: [debug] Loaded Path actions: .-+--. | Path| Private | +-+--+ | / | /index | | / | /index | | / | /default | | / | /default | | /whatever/hello | /whatever/hello | | /whatever/hello | /whatever/hello | | /whatever/howdy | /whatever/howdy | '-+--' So, I guess what I really would like is a way to have it load the Foo::* modules but register their actions in the associated Bar:: namespace so that /whatever/hello calls Bar::Whatever::hello but Foo::Whatever is the parent class if hello() doesn't exist in Bar. (That sentense make sense?) I guess that means when Foo::Controller::Whatever is found, register the actions in the Bar::Whatever namespace and push Foo::Whatever onto @Bar::Whatever::ISA. The problem I'm looking at is rebranding applications. In the past I've managed to modify config based on, say, domain name and use a different root (for templates, css, images, etc.) But, over time the application has to be forked due to changes in code. But, 90% of the controller code is still the same between the two applications. So, it would be handy to say, this application inheits from Foo, but these with a few methods added or overridden. -- Bill Moseley mose...@hank.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] Sub-classing Application
On Wed, Dec 16, 2009 at 9:27 AM, Bill Moseley mose...@hank.org wrote: On Wed, Dec 16, 2009 at 8:31 AM, J. Shirley jshir...@gmail.com wrote: The documentation seems quite sparse, but if you look at the source it just essentially does: my $locator = Module::Pluggable::Object-new( search_path = [ map { s/^(?=::)/$class/; $_; } @paths ], %$config ); If you have MyApp-config-{search_extra} = [ 'Foo::Controller', 'Foo::Model' ]; it should DTRT. It almost works, but it sets up actions for both controllers using each controller's class. That is, if I start application Bar and pass in search_extra = [qw/ Foo::Controller / ] then indeed actions from Foo::Controller::* will get added to the application. But, they are added with the Foo:: namespace. that is, that controller is not a parent-class of Bar::Controller::*. It also means I can't easly overide. If I have hello() in both thes controllers: Foo::Controller::Whatever::hello() Bar::Controller::Whatever::hello() I then get: [debug] Loaded Path actions: .-+--. | Path | Private | +-+--+ | / | /index | | / | /index | | / | /default | | / | /default | | /whatever/hello | /whatever/hello | | /whatever/hello | /whatever/hello | | /whatever/howdy | /whatever/howdy | '-+--' So, I guess what I really would like is a way to have it load the Foo::* modules but register their actions in the associated Bar:: namespace so that /whatever/hello calls Bar::Whatever::hello but Foo::Whatever is the parent class if hello() doesn't exist in Bar. (That sentense make sense?) I guess that means when Foo::Controller::Whatever is found, register the actions in the Bar::Whatever namespace and push Foo::Whatever onto @Bar::Whatever::ISA. The problem I'm looking at is rebranding applications. In the past I've managed to modify config based on, say, domain name and use a different root (for templates, css, images, etc.) But, over time the application has to be forked due to changes in code. But, 90% of the controller code is still the same between the two applications. So, it would be handy to say, this application inheits from Foo, but these with a few methods added or overridden. It seems you're after something that would best be accomplished using roles that get composed into the controller. http://search.cpan.org/~hkclark/Catalyst-Manual-5.8002/lib/Catalyst/Manual/CatalystAndMoose.pod#ROLES_AND_METHOD_MODIFIERS I've done similar things (and maintain it) and the sections that I refactored to use this method are much more maintainable (and using Chained). When I just mix random things or maintain a copy'n'paste swath, bad things happen. Probably not an ideal answer, but I actually found the refactoring was pretty easy. Essentially: cp Controller/Foo.pm MyApp/Role/Controller/Foo.pm then converting it to use Moose::Role syntax per the CatalystAndMoose pod, then modifying everything to just do 'with Controller::Foo'; It's hard-coded still, and not ideal, but for me at least it is write-once-forget-forever (and I see exactly what is composed into the class, which makes debugging easier). That's about the best I have for you, sorry :) -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] Sub-classing Application
On Wed, Dec 16, 2009 at 9:59 AM, J. Shirley jshir...@gmail.com wrote: It seems you're after something that would best be accomplished using roles that get composed into the controller. Ah, of course. I think that's a good idea. I rewrote a bunch of plugins and other code using Roles and indeed it was pretty painless. Means I need to make mostly duplicate and empty controllers for both Foo and Bar applications but seems like a reasonable price to pay. Now, I just need to think about good ways to inherit my temples (if not simply modifying my INCLUDE_PATH) so that templates can be shared (or overridden). Thanks, -- Bill Moseley mose...@hank.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] Apache + mod_perl + Digest-SHA fails
I have an Apache 2.2.14 server with mod-perl 2.0.4 and Catalyst 5.80015 on a Windows XP machine. My system runs fine from the built-in Catalyst web server. When I run it through my Apache server, however it fails with the folowing error: [info] NPC powered by Catalyst 5.80015 Free to wrong pool 760e18 not 26fe70 at C:/Perl/lib/Digest/SHA.pm line 63 during global destruction. [Wed Dec 16 12:22:34 2009] [crit] (OS 6)The handle is invalid. : master_main: create child process failed. Exiting. The Digest::SHA is used to handle the login, of course. I have used the example from the tutorial. Any ideas why this is occurring? If I remove the call from the Schema/Result/Account.pm, it will run. __PACKAGE__-add_columns( 'password' = { data_type = TEXT, size= undef, encode_column = 1, encode_class= 'Digest', encode_args = {salt_length = 10}, encode_check_method = 'check_password', }, }; I was going to switch to blowfish, but I keep getting a 'bad bcrypt settings' error. I read that it is for Unix only though, so I guess I should have expected that. ___ 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] Apache + mod_perl + Digest-SHA fails
Free to wrong pool is usually an issue with XS and threading. Digest::SHA is an XS module. Which Perl are you using? And how is it integrated into Apache? I've generally found FastCGI to be safer on Windows, simply because it doesn't require the tight integration of Perl into Apache under Windows. --S -- Stuart Watt ARM Product Developer Information Balance Ascii King wrote: I have an Apache 2.2.14 server with mod-perl 2.0.4 and Catalyst 5.80015 on a Windows XP machine. My system runs fine from the built-in Catalyst web server. When I run it through my Apache server, however it fails with the folowing error: [info] NPC powered by Catalyst 5.80015 Free to wrong pool 760e18 not 26fe70 at C:/Perl/lib/Digest/SHA.pm line 63 during global destruction. [Wed Dec 16 12:22:34 2009] [crit] (OS 6)The handle is invalid. : master_main: create child process failed. Exiting. The Digest::SHA is used to handle the login, of course. I have used the example from the tutorial. Any ideas why this is occurring? If I remove the call from the Schema/Result/Account.pm, it will run. __PACKAGE__-add_columns( 'password' = { data_type = TEXT, size= undef, encode_column = 1, encode_class= 'Digest', encode_args = {salt_length = 10}, encode_check_method = 'check_password', }, }; I was going to switch to blowfish, but I keep getting a 'bad bcrypt settings' error. I read that it is for Unix only though, so I guess I should have expected that. ___ 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/ -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=CF5252806D.4D760 ___ 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] Sub-classing Application
On 16 Dec 2009, at 17:27, Bill Moseley wrote: It also means I can't easly overide. If I have hello() in both thes controllers: Foo::Controller::Whatever::hello() Bar::Controller::Whatever::hello() I then get: [debug] Loaded Path actions: .- +--. | Path| Private | +- +--+ | / | / index | | / | / index | | / | / default | | / | / default | | /whatever/hello | /whatever/ hello | | /whatever/hello | /whatever/ hello | | /whatever/howdy | /whatever/ howdy | '- +--' So, I guess what I really would like is a way to have it load the Foo::* modules but register their actions in the associated Bar:: namespace so that /whatever/hello calls Bar::Whatever::hello but Foo::Whatever is the parent class if hello() doesn't exist in Bar. Hmmm. Sooo, what happens is that Catalyst::Component calls the COMPONENT method on each component, passing it a 'catalyst_component_name' parameter as config. So in your case, Foo::Controller::Whatever-COMPONENT($app, { catalyst_component_name = 'Foo::Controller::Whatever' } ); should be called. What should happen is that the component is then registered in the component registry with the name found by calling the - catalyst_component_name accessor on the generated instance.. This unfortunately isn't how it works.. :( As if that worked, then you could return 'Bar::Controller::Whatever', and the component system should register the first thing with each name... Ergo, you'd load all the 'real' Bar::Controller::* modules in your app, and then load all the Foo::Controller::(.*) modules from the alternate namespace, registering them as Bar::Controller::$1 (but not doing so if Bar::Controller::$1 already exists). Tests for this working would be the most arduous part of this development. If anyone would like to contribute them, then I'd be happy to work on the core changes to make what you want to do trivially possible. 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] Apache + mod_perl + Digest-SHA fails
Stuart Watt wrote: Free to wrong pool is usually an issue with XS and threading. Digest::SHA is an XS module. Which Perl are you using? And how is it integrated into Apache? I've generally found FastCGI to be safer on Windows, simply because it doesn't require the tight integration of Perl into Apache under Windows. --S -- Stuart Watt ARM Product Developer Information Balance I have Perl v5.8.9 I suspected it was something to do with threads only because I couldn't figure out how threading or the pre-fork stuff was supposed to be set up on Windows. I thought I read though, that the threading issue didn't matter on Windows. I did have FastCGI working. I switched because the Catalyst Cookbook recommended mod_perl. I'll try that again. ___ 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] go to chained action
On 16 Dec 2009, at 13:18, Alex Povolotsky wrote: Hello! Having, for example, /controller/*/action handled by /controller/ base (1) = /controller/action, how do I write correct go to / controller/argument/action ? just $c-go('/controller/argument/action') does not work. $c-go('/ controller/action', [qw(argument)]) does not work as well, while $c- detach('/controller/action', [qw(argument)]) seems to be working. Actually, I'm looking for some kind of internal redirect. Try $c-go($c-controller('MyController')-action_for('action_name'), [], [qw/ argument /]); The go method is documented as: $c-go( $action [, \...@captures, \...@arguments ] ) $c-go( $class, $method, [, \...@captures, \...@arguments ] ) So what you're trying is documented as not working :) You _may_ get away with Try $c-go($c-controller('MyController')-action_for('action_name'), [qw/ argument /]); (i.e. omitting the captures if you only want args), but I'm unsure about that. 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] Apache + mod_perl + Digest-SHA fails
I did have FastCGI working. I switched because the Catalyst Cookbook recommended mod_perl. I'll try that again. Where, exactly? Could you please point out the specific section so I can GO BEAT IT WITH A STICK. A STICK WITH RUSTY NAILS HAMMERED THROUGH IT. cough Thanks in advance. 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/
[Catalyst] Renaming a Catalyst Application
Hi, I'm rebuilding my development environment from backups after a system failure. Being new to Catalyst, I started with the tutorial application MyApp and, as some of the pieces of the tutorial were sound enough to use in a real application, continued to develop, building new Controllers and Models, under that space. At some point I decided MyApp was not a good name for a production application, so I renamed the top level directory from MyApp to something better, like OfficialSoundingProductionApp. Now that I'm unpacking my backup tar files onto the new system, I decided to run the catalyst.pl -force -scripts MyApp command and start doing whatever else I'll need, to re-install and such to get going again. However, the script apparently expects the file paths to start with the app name on the top level matching the first part of script names. I get the error: Couldn't create MyApp/script/myapp_cgi.pl, No such file or directory So my question is, when I decided to morph the tutorial into a production application, what would have been the best way to change the name of the application? (Overall this seem like the proper solution to the current problem, too.) Or, barring that, is it possible to update the scripts, (using the catalyst.pl helper script), when they still have the MyApp name prefix, in a top level directory of a different name? I might try a link: ln -s OfficialSoundingProductionApp MyApp to make things work, but the in-elegance of that possible solution makes me gasp. I reinstalled Catalyst Runtime 5.80016 and Development 1.24. I was at 5.80007. Creating an empty catalyst application serves the default Catalyst page, so the basic reinstall of Catalyst seems to work. Thanks, Tom ___ 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] Apache + mod_perl + Digest-SHA fails
Threading is possibly even worse on Windows. Any forking on Windows is really Perl threading as Windows doesn't have fork() as its process model. Are you using Randy Kobes' mod_perl for ActivePerl? I have not done that configuration for a while, but I did get it working once. Your other option is to compile your own Apache+mod_perl -- a bit of a challenge but certainly possible, and quite likely to resolve the problem. The problems arise because mod_perl has to plug the whole of Perl into Apache. This requires Apache and Perl to be compiled in ways that are partly compatible. mod_perl has some flexibility in this, but I always found it pretty troublesome, and in any event, the Perl threads on Windows will be within Apache processes. FastCGI allows you to move Perl processes outside Apache, so they are wholly independent of each other, and no longer require any binary compatibility. The downside is that you don't memory sharing, which you get with prefork, especially on platforms that have a proper process fork(). Unfortunately, Windows doesn't have that true fork(), so the memory sharing is only working because you are working in a single (Windows) process. Our Perl processes on Windows are not that big (they commonly start at VM sizes of 50-60Mb, and only get larger when we start the high-powered search systems we use). A decent server can easily accommodate 40 or so of these. Personally, on Windows, I'd stick with FastCGI. We've been using it for a year or more and it has survived some fairly large scale stress testing. --S -- Stuart Watt ARM Product Developer Information Balance Ascii King wrote: Stuart Watt wrote: Free to wrong pool is usually an issue with XS and threading. Digest::SHA is an XS module. Which Perl are you using? And how is it integrated into Apache? I've generally found FastCGI to be safer on Windows, simply because it doesn't require the tight integration of Perl into Apache under Windows. --S -- Stuart Watt ARM Product Developer Information Balance I have Perl v5.8.9 I suspected it was something to do with threads only because I couldn't figure out how threading or the pre-fork stuff was supposed to be set up on Windows. I thought I read though, that the threading issue didn't matter on Windows. I did have FastCGI working. I switched because the Catalyst Cookbook recommended mod_perl. I'll try that again. ___ 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/ -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=0E7092806D.D7113 ___ 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] Apache + mod_perl + Digest-SHA fails
On 16 Dec 2009, at 21:00, Stuart Watt wrote: FastCGI allows you to move Perl processes outside Apache, so they are wholly independent of each other, and no longer require any binary compatibility. The downside is that you don't memory sharing, which you get with prefork, especially on platforms that have a proper process fork(). Er, no - your fcgi process manager loads the app and calls fork() for you, so you get memory sharing. In mod_perl, apache is driving, so it calls fork(), and then asks the perl interpreter to clone itself. This also tries to 'do the right thing', keeping preloaded code shared. IME, mod_perl tends to be _less_ efficient at this (as interpreter cloning is less trivial than simple fork), but you get (at least some of) the same shared memory / copy on write effect from both, even on win32 where fork() is emulated. 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] Apache + mod_perl + Digest-SHA fails
Tomas Doran wrote: Er, no - your fcgi process manager loads the app and calls fork() for you, so you get memory sharing. Sorry, you're right - we're using a very limited process manager and it doesn't fork. We use some nasty nonthreadsafe legacy C code. Since on Windows both types of fork are emulated in Perl, whether in mod_perl or in the FCGI process manager, I guess the performance is almost equivalent. (Is this true? -- anybody benchmarked the two??) That just leaves the pain of setting up mod_perl. I used to do that, but I never really enjoyed it. --S Stuart Watt ARM Product Developer Information Balance ___ 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] Apache + mod_perl + Digest-SHA fails
Octavian Râsnita wrote: If you use ActivePerl under Windows, mod_perl can be installed from the TheoryX ppm repository and it doesn't require too much configuration. Using fastcgi under Windows is harder, and I don't even know if it can run as an ExternalServer. For Apache possibly. The mod_perl clone for IIS (ActiveState's PerlEx) is virtually unsupported and has (had?) low-level bugs; because it is closed source there is almost nothing you do can about them. We were therefore effectively forced into using FastCGI, which has certainly proven portable, scalable, and with acceptable performance even under IIS. (IIS, need I say it, was not our choice). IIS FastCGI support is now pretty good because of the Zend/Microsoft collaboration, although PHP is the principal beneficiary. Don't get me wrong - I was a big fan of Apache and mod_perl on Windows, I was compiling it for mission-critical applications in 2001 - applications which were still in use and running stable on the same server 8 years later!!! All the best Stuart -- Stuart Watt ARM Product Developer Information Balance ___ 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] Apache + mod_perl + Digest-SHA fails
On 16 Dec 2009, at 22:16, Octavian Râsnita wrote: Using fastcgi under Windows is harder, and I don't even know if it can run as an ExternalServer. Yes, it totally can, however not on a local socket tcp-ip only. But dynamic FCGI Catalyst works out the box with IIS if you want the easiest option. 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] Renaming a Catalyst Application
t0m, Thanks. I'm trying the link method and it is good to know it should work. There is a lot of Auto-Magical behavior in Catalyst and the helper scripts; or so it seems. By arbitrarily changing the name of the top level directory, may I have broken any of it? Particularly, the make scripts I will need when I go to actually deploy the app? This system crash, in the big scheme of things, may be a good thing. As it is forcing me to take a crash refresher course on how I got from an initial Catalyst install to the application I have now. Very helpful; when I go to deploy. Tom --On Wednesday, December 16, 2009 11:17:57 PM + Tomas Doran bobtf...@bobtfish.net wrote: On 16 Dec 2009, at 20:57, Tom Stall wrote: Or, barring that, is it possible to update the scripts, (using the catalyst.pl helper script), when they still have the MyApp name prefix, in a top level directory of a different name? I might try a link: ln -s OfficialSoundingProductionApp MyApp to make things work, but the in-elegance of that possible solution makes me gasp. That will work. Or just catalyst.pl MyApp; cp MyApp/script/* OfficialSoundingProductionApp/script/* either is good. That aside, renaming your production application's top level directory doesn't actually rename the classes, so they're still all called MyApp :) The purest in me would like to have a way to rename all the internal class references. But the practical developer in me can, I suppose, live with this. 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] Renaming a Catalyst Application
On 17 Dec 2009, at 00:26, Tom Stall wrote: There is a lot of Auto-Magical behavior in Catalyst and the helper scripts; or so it seems. Not really, all the scripts generated have the name of the application buried in them, and then (assuming you're using a checkout) they'll automatically find the lib/ directory by relative paths.. By arbitrarily changing the name of the top level directory, may I have broken any of it? Particularly, the make scripts I will need when I go to actually deploy the app? No, again this all only cares about the structure below the top. This system crash, in the big scheme of things, may be a good thing. As it is forcing me to take a crash refresher course on how I got from an initial Catalyst install to the application I have now. Very helpful; when I go to deploy. Indeed :) I guess you also found a couple of things missing which weren't listed as dependencies in Makefile.PL? 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] Renaming a Catalyst Application
I guess you also found a couple of things missing which weren't listed as dependencies in Makefile.PL? Are these the ones mentioned in an earlier thread? Not at the point where I know yet. But, I'm cheating; I'm loading a lot of the dependencies first, by installing the tutorial from CPAN. 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] Renaming a Catalyst Application
On 17 Dec 2009, at 01:07, Tom Stall wrote: I guess you also found a couple of things missing which weren't listed as dependencies in Makefile.PL? Are these the ones mentioned in an earlier thread? Erm, they're the ones you added to your app as you wrote it.. Not at the point where I know yet. But, I'm cheating; I'm loading a lot of the dependencies first, by installing the tutorial from CPAN. And your deployment method for production applications on production systems is going to involve installing the tutorial as an explicit step? That's fairly horrible in itself, and you are also relying on the fact that 'best practice' won't move on in a way which will result in things your app needs being dropped - hmmm... 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] Renaming a Catalyst Application
--On Thursday, December 17, 2009 01:15:52 AM + Tomas Doran bobtf...@bobtfish.net wrote: On 17 Dec 2009, at 01:07, Tom Stall wrote: I guess you also found a couple of things missing which weren't listed as dependencies in Makefile.PL? Are these the ones mentioned in an earlier thread? Erm, they're the ones you added to your app as you wrote it.. Not at the point where I know yet. But, I'm cheating; I'm loading a lot of the dependencies first, by installing the tutorial from CPAN. And your deployment method for production applications on production systems is going to involve installing the tutorial as an explicit step? That's fairly horrible in itself, and you are also relying on the fact that 'best practice' won't move on in a way which will result in things your app needs being dropped - hmmm... t0m, Excellent point As this is my first time through this, I setup a sandbox to work through the process. I will do it again, with a hopefully greater level of understanding, to continue development. Tom 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] Catalyst::View::Thumbnail
Has anyone successfully got Catalyst::View::Thumbnail to work? I'm trying to add this to my app to create thumbnails on the fly for me so I don't have to make them ahead of time with Image::Magick. So, I'm following the guide from this page here: http://perl.jonallen.info/writing/articles/creating-thumbnails-with-catalyst However, as soon as I add the view Thumbnail.pm (by doing script/ myapp_create.pl view Thumbnail Thumbnail), no matter what I do, any page in my app produces the following error: Couldn't render image: Image data missing from stash I created an Images file model and a thumbnail controller exactly like in the guide, but still get the error. Even if I don't put any code in my app at all to do with thumbnails, and never forward to the Thumbnail.pm view, I still get this error just by the mere presense of the view Thumbnail.pm Also, I looked in the file Thumbnail.pm that was created, and its mostly empty, except for the pod. This is all the file has in it: package MyApp::View::Thumbnail; use strict; use parent 'Catalyst::View::Thumbnail'; =head1 NAME ... the rest is all pod. Is this normal, or is there something screwed up with my installation? Any help you can provide would be appreciated. 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] Renaming a Catalyst Application
Tom == Tom Stall t...@es.net writes: Tom t0m, Tom Excellent point As this is my first time through this, I Tom setup a sandbox to work through the process. I will do it Tom again, with a hopefully greater level of understanding, to Tom continue development. A good way to figure out the deps is to load your application then check %INC, it's pretty trivial to munge the file paths in the keys/values and produce output suitable for appening into Makefile.PL, of course, it isn't perfect, as it lists core modules and doesn't figure out what modules were installed as dependencies, but it's a good start for a production-worthy Makefile.PL -- Eden Cardim Need help with your Catalyst or DBIx::Class project? Code Monkeyhttp://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://edenc.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/
Re: [Catalyst] Catalyst::View::Thumbnail
On Wed, Dec 16, 2009 at 9:18 PM, Meeko meeko.li...@gmail.com wrote: Has anyone successfully got Catalyst::View::Thumbnail to work? I'm trying to add this to my app to create thumbnails on the fly for me so I don't have to make them ahead of time with Image::Magick. So, I'm following the guide from this page here: http://perl.jonallen.info/writing/articles/creating-thumbnails-with-catalyst However, as soon as I add the view Thumbnail.pm (by doing script/myapp_create.pl view Thumbnail Thumbnail), no matter what I do, any page in my app produces the following error: Couldn't render image: Image data missing from stash I created an Images file model and a thumbnail controller exactly like in the guide, but still get the error. Even if I don't put any code in my app at all to do with thumbnails, and never forward to the Thumbnail.pm view, I still get this error just by the mere presense of the view Thumbnail.pm Also, I looked in the file Thumbnail.pm that was created, and its mostly empty, except for the pod. This is all the file has in it: package MyApp::View::Thumbnail; use strict; use parent 'Catalyst::View::Thumbnail'; =head1 NAME ... the rest is all pod. Is this normal, or is there something screwed up with my installation? Any help you can provide would be appreciated. Thanks! Any time you have multiple views, you *must* declare which view you want Catalyst to use by default. To accomplish this, in your application config just provide: default_view: TT (or whatever your default view is) You can put this in MyApp.pm or myapp.(conf|yml) as a top level configuration option. -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] Catalyst::View::Thumbnail
That was my problem. Thanks! It works perfectly now! On Thu, Dec 17, 2009 at 12:42 AM, J. Shirley jshir...@gmail.com wrote: On Wed, Dec 16, 2009 at 9:18 PM, Meeko meeko.li...@gmail.com wrote: Has anyone successfully got Catalyst::View::Thumbnail to work? I'm trying to add this to my app to create thumbnails on the fly for me so I don't have to make them ahead of time with Image::Magick. So, I'm following the guide from this page here: http://perl.jonallen.info/writing/articles/creating-thumbnails-with-catalyst However, as soon as I add the view Thumbnail.pm (by doing script/myapp_create.pl view Thumbnail Thumbnail), no matter what I do, any page in my app produces the following error: Couldn't render image: Image data missing from stash I created an Images file model and a thumbnail controller exactly like in the guide, but still get the error. Even if I don't put any code in my app at all to do with thumbnails, and never forward to the Thumbnail.pm view, I still get this error just by the mere presense of the view Thumbnail.pm Also, I looked in the file Thumbnail.pm that was created, and its mostly empty, except for the pod. This is all the file has in it: package MyApp::View::Thumbnail; use strict; use parent 'Catalyst::View::Thumbnail'; =head1 NAME ... the rest is all pod. Is this normal, or is there something screwed up with my installation? Any help you can provide would be appreciated. Thanks! Any time you have multiple views, you *must* declare which view you want Catalyst to use by default. To accomplish this, in your application config just provide: default_view: TT (or whatever your default view is) You can put this in MyApp.pm or myapp.(conf|yml) as a top level configuration option. -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/ ___ 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/