[Catalyst] PAR Deployment
Hi all, I am quite new to the framework and was trying to deploy my application as a PAR archive. I have tried to follow all the different ways from the Advent Calendars and also as per PAR::Tutorial and I can't seem to get this to work. I'm sure there have been successful deployments using this method. So, can someone please point me in the right direction for deploying a Catalyst application as a PAR. The servers I'm trying this on are: 1. Mac OS X 10.4.8 (Tiger) 2. Linux i686 GNU/Linux Thanks, Adeola. -- Creative Developer - Digital Craftsmen Ltd Exmouth House, 3 Pine Street London, EC1R 0JH t: +44 20 7183 1410 f: +44 20 7099 5140 m: +44 79 3952 0786 w: http://www.digitalcraftsmen.net/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] context object in TT
On 15 Mar 2007, at 17:01, rahed wrote: [% c.config.name %] in the template, nothing is shown. I think this needs to be: [% Catalyst.config.name %] I call template like this: $c->stash->{template}->'books/view.tt2'; And this needs to be: $c->stash->{template} = 'books/view.tt2'; HTH, Adeola. ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Changing the request->user_agent
Hi all, Is it possible to change the request->user_agent? I am writing some tests where I want to set the user_agent before making the request and have my app behave differently depending on the user agent. Thanks, Adeola. ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Changing the request->user_agent
On 20 Mar 2007, at 23:39, Bogdan Lucaciu wrote: I'm sure this works with Test::WWW::Mechanize::Catalyst as well Thanks guys. That led me along the right path. I was able to replace: use_ok 'Catalyst::Test', 'MyApp'; with: use_ok 'Test::WWW::Mechanize::Catalyst', 'MyApp'; And then set the User-Agent header like so: $mech->agent( 'Test Agent/0.1' ) Thanks all. Adeola. ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] internal redirect
Hi all, Is there a way to do an internal redirect in Catalyst? In my application I'm generating images on the fly and want to redirect to the image if creation succeeds. For instance: $image = Imager->new() $image->read( file => $src_file ); $new_img = $image->copy->scale( xpixels => 32, ypixels => 32 ); if ( $new_img->write( file => $new_filename ) ) { # do internal redirect to new file here } I tried using "$c->response->redirect( $new_filepath )" but that issues a 302 "Temporarily Moved" status. But what I actually want is a way to do the redirect outside of the response chain. I hope this is clear?! Thanks, Adeola. -- Creative Developer - Digital Craftsmen Ltd Exmouth House, 3 Pine Street London, EC1R 0JH t: +44 20 7183 1410 f: +44 20 7099 5140 m: +44 79 3952 0786 w: http://www.digitalcraftsmen.net/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] internal redirect
On 11 Apr 2007, at 15:55, Eduard Giménez wrote: Maybe $c->forward( $new_filepath )? I don't think this would work as you can only forward to actions or components. Adeola -- Creative Developer - Digital Craftsmen Ltd Exmouth House, 3 Pine Street London, EC1R 0JH t: +44 20 7183 1410 f: +44 20 7099 5140 m: +44 79 3952 0786 w: http://www.digitalcraftsmen.net/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] internal redirect
On 11 Apr 2007, at 16:43, Bill Moseley wrote: On Wed, Apr 11, 2007 at 03:28:59PM +0100, Adeola Awoyemi wrote: if ( $new_img->write( file => $new_filename ) ) { I tried using "$c->response->redirect( $new_filepath )" but that issues a 302 "Temporarily Moved" status. I suspect your web document root is not the root of the file system. Oops -- I read those as the same variable. Shows, how important it is to use good variable names. Are you sure $new_filepath is really where you are saving the image? Yes, the new image is being created as $new_filepath. By $new_filepath I mean uri_path and $new_filename is system_path. Adeola. ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] MySQL server has gone away
Hi all, I have problem that when I run my app via fastcgi I get an error where one of my models can't connect to the database with the message "MySQL server has gone away". When I start it using 'script/ myapp_server.pl' it works fine. Has anyone come across this before? Any hints to fixing this would be greatly appreciated. Regards, Adeola. ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] MySQL server has gone away
On 19 Apr 2007, at 14:31, Jon wrote: On Thu, 2007-04-19 at 13:54 +0100, Adeola Awoyemi wrote: Hi all, I have problem that when I run my app via fastcgi I get an error where one of my models can't connect to the database with the message "MySQL server has gone away". When I start it using 'script/ myapp_server.pl' it works fine. Would I be correct in guessing that you're using DBI directly, not Catalyst::Model::DBI or Catalyst::Model::DBIC::Schema ? Yes. This problem will occur when a process forks after creating a DBI connection, since the connection becomes invalid in the child process. See the code in Catalyst::Model::DBI for ways to handle this. OK. Thanks. I'll have a look and hopefully this will all be fixed. Its really strange, 'cause it worked for a short while (maybe about 12 - 24 hours) after deploying it but then it just gave up. Thanks again Jon and everyone else. I'll keep you posted. Adeola. ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] MySQL server has gone away
Hi all, It works again now. I looked at Catalyst::Model::DBI and noticed it was using $self->NEXT::new( @_ ) so I did the same thing with my Model and it seemed to work without a hitch! Well, thanks all for you help. Regards, Adeola. On 19 Apr 2007, at 14:38, Adeola Awoyemi wrote: Thanks again Jon and everyone else. I'll keep you posted. -- Creative Developer - Digital Craftsmen Ltd Exmouth House, 3 Pine Street London, EC1R 0JH t: +44 20 7183 1410 f: +44 20 7099 5140 m: +44 79 3952 0786 w: http://www.digitalcraftsmen.net/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] SubRequest and template recursion
Hi all, I have a template (page.tt2) that uses TT's VIEW directive, where I'm making a sub-request: [% BLOCK feed; data = Catalyst.subreq("/feed/$feed_url"); data; END; %] In my controller: sub get_feed : LocalRegex('^(.*$) ) { my ( $self, $c ); my $src_url = $c->request->captures->[0]; my $content = get($src_url); # already USE(ing) LWP::Simple above $c->stash->{source_string} = $content; $c->stash->{template} = 'feed.tt2'; } But instead of a return of the results of running the source through the feed.tt2 template I get an error "file error - recursion into 'page.tt2'". Any help, hints would be gratefully appreciated. Adeola. -- Creative Developer - Digital Craftsmen Ltd Exmouth House, 3 Pine Street London, EC1R 0JH t: +44 20 7183 1410 f: +44 20 7099 5140 m: +44 79 3952 0786 w: http://www.digitalcraftsmen.net/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Using a custom TT filter
Hello, In your TT::View you could add: use base 'Catalyst::View::TT'; sub noDia { my $text = shift; $text =~ tr/ăşţîâĂŞŢÎÂ/astiaASTIA/; return $text; } __PACKAGE__->config({ FILTERS => { 'noDia' => \&noDia, }, }); So, in your template you should be able to use: [% FILTER noDia -%] data to parse [% END %] I hope this helps. This is just form my knowledge of TT. I'm still getting used to Catalyst so someone else might have a better idea but its worth a try ;) Adeola On 22 May 2007, at 11:20, Octavian Rasnita wrote: Hi, I am trying to use a custom TT filter in a Catalyst app. In MyApp.pm I use: 'View::TT' => { PLUGIN_BASE => __PACKAGE__->path_to('lib'), }, In the lib dir I have a Diverse/NoDia.pm module that looks like this: package Diverse::NoDia; use Template::Plugin::Filter; use base 'Template::Plugin::Filter'; sub filter { my ($self, $text) = @_; $text =~ tr/ăşţîâĂŞŢÎÂ/astiaASTIA/; return $text; } 1; In the template I use: [% USE NoDia = Diverse.NoDia -%] [% FILTER $NoDia -%] ... [% END %] But it gives the following error: Couldn't render template "plugin error - Can't locate object method "load" via package "D:\web\TranzactiiBursiere \lib::Diverse::NoDia" (perhaps you forgot to load "D:\web\TranzactiiBursiere\lib::Diverse::NoDia"?) at D:/usr/ site/lib/Template/Plugins.pm line 215. " How can I define a custom TT filter in a Catalyst app? (I need to filter a text depending on a condition, and I don't know if I can use another method for doing this.) Thank you. Octavian ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/ catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/ -- Creative Developer - Digital Craftsmen Ltd Exmouth House, 3 Pine Street London, EC1R 0JH t: +44 20 7183 1410 f: +44 20 7099 5140 m: +44 79 3952 0786 w: http://www.digitalcraftsmen.net/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] SubRequest and template recursion
Thanks. That seemed to work :) Now I'm getting "File not found error" with XML::XPath not lining the fact that I'm passing it a string rather than a file :( Adeola. On 22 May 2007, at 15:04, Matt S Trout wrote: Add RECURSION => 1 to your View::TT config. -- Creative Developer - Digital Craftsmen Ltd Exmouth House, 3 Pine Street London, EC1R 0JH t: +44 20 7183 1410 f: +44 20 7099 5140 m: +44 79 3952 0786 w: http://www.digitalcraftsmen.net/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] SubRequest and template recursion
On 22 May 2007, at 15:57, Dave Howorth wrote: Adeola Awoyemi wrote: Thanks. That seemed to work :) Now I'm getting "File not found error" with XML::XPath not lining the fact that I'm passing it a string rather than a file :( From TFM: new() This constructor follows the often seen named parameter method call. Parameters you can use are: filename, parser, xml, ioref and context. The filename parameter specifies an XML file to parse. The xml parameter specifies a string to parse ^ Dave, In my Template I already have that: [% USE doc = XML.XPath( xml => source_string ); node = doc.findnodes('/rss'); adaptation.print(node); -%] I also tried using 'text' as in Template::Plugin::XML::XPath docs, with no luck. Adeola. ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Using other Modules
Sven Eppler wrote: So i'm asking for a way, i can tell "i need module X" so that perl can complain about it at apllication-start-time if it's not intalled but not carry the entire exported module stuff throughout my entire app if i only need it in one special place? Hi Sven, Add it to your Makefile.PL file to the list in the requires() directive: requires( ... Crypt::PassGen => 0, # get the latest version ); This is the normal way of saying that an app needs a module when installing. Hope this helps. Adeola. -- Creative Developer - Digital Craftsmen Ltd Exmouth House, 3 Pine Street London, EC1R 0JH t: +44 20 7183 1410 f: +44 20 7099 5140 m: +44 79 3952 0786 w: http://www.digitalcraftsmen.net/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Problems forwarding to view
Hi all, I'm trying to use Catayst::View::XSLT and my end sub looks like this: # from MyApp::Controller::Root sub end : Private { my ( $c, $self ) = @_; $c->forward( $c->view('XSLT') ); } but when I make a request to the server I get an error: [error] Caught exception in MyApp::Controller::Root->end "Can't locate object method "view" via package "MyApp::Controller::Root" at /Users/adeola/projects/MyApp/script/../lib/MyApp/Controller/Root.pm line 160." I have even tried: c->forward('MyApp::View::XSLT'); and that gives the the error: [error] Caught exception in MyApp::Controller::Root->end "Can't locate object method "forward" via package "MyApp::Controller::Root" at /Users/adeola/projects/MyApp/script/../lib/MyApp/Controller/Root.pm line 160." Am I missing something? Any tips/leads would be greatly appreciated. Adeola. -- Creative Developer - Digital Craftsmen Ltd Exmouth House, 3 Pine Street London, EC1R 0JH t: +44 20 7183 1410 f: +44 20 7099 5140 m: +44 79 3952 0786 w: http://www.digitalcraftsmen.net/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Problems forwarding to view
Brian Cassidy wrote: Adeola Awoyemi wrote: # from MyApp::Controller::Root sub end : Private { my ( $c, $self ) = @_; $c->forward( $c->view('XSLT') ); } try: my( $self, $c ) = @_; Doh! How could I have missed that one?! I feel sheepish ;-) Thanks Brian & Peter. -- Creative Developer - Digital Craftsmen Ltd Exmouth House, 3 Pine Street London, EC1R 0JH t: +44 20 7183 1410 f: +44 20 7099 5140 m: +44 79 3952 0786 w: http://www.digitalcraftsmen.net/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Multiple FastCGI app servers with Apache2
Tobias Kremer wrote: Does anyone know if it's possible to distribute requests to multiple external FastCGI servers with Apache2 + mod_fastcgi similar to the round-robin load-balancing approach lighttpd provides? I have this large legacy app running on mod_perl behind an apache2 reverse proxy where I'd like to plug in my new Catalyst app via FastCGI which eventually should run on more than one physical app server. If possible I'd like to stick with Apache2 as the reverse proxy for now ... This is possible (as I have done the same) by adding multiple instances of: FastCgiExternalServer /path/to/MyApp/script/myapp_fastcgi.pl -host 127.0.0.1:55901 to the apache2 config file. Also make sure you use different ports or sockets. Adeola. -- Creative Developer - Digital Craftsmen Ltd Exmouth House, 3 Pine Street London, EC1R 0JH t: +44 20 7183 1410 f: +44 20 7099 5140 m: +44 79 3952 0786 w: http://www.digitalcraftsmen.net/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Multiple FastCGI app servers with Apache2
Tobias Kremer wrote: Tobias Kremer wrote: Does anyone know if it's possible to distribute requests to multiple external FastCGI servers with Apache2 + mod_fastcgi similar to the round-robin load-balancing approach lighttpd provides? This is possible (as I have done the same) by adding multiple instances of: FastCgiExternalServer /path/to/MyApp/script/myapp_fastcgi.pl -host 127.0.0.1:55901 to the apache2 config file. Also make sure you use different ports or sockets. I already tried that and it gives me: FastCgiExternalServer: redefinition of previously defined class "/srv/myapp.fcgi". I'm using mod_fastcgi-SNAP-0404142202 with Apache 2.0.59 both compiled from source. Do you have each FastCgiExternalServer directive pointing to a different instance of the application. E.g. FastCgiExternalServer /path/myapp_fastcgi.pl -host 127.0.0.1:55900 FastCgiExternalServer /path2/myapp_fastcgi.pl -host 127.0.0.1:55901 Adeola. -- Creative Developer - Digital Craftsmen Ltd Exmouth House, 3 Pine Street London, EC1R 0JH t: +44 20 7183 1410 f: +44 20 7099 5140 m: +44 79 3952 0786 w: http://www.digitalcraftsmen.net/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Multiple FastCGI app servers with Apache2
Tobias Kremer wrote: Tobias Kremer wrote: FastCgiExternalServer: redefinition of previously defined class "/srv/myapp.fcgi". I'm using mod_fastcgi-SNAP-0404142202 with Apache 2.0.59 both compiled from source. Do you have each FastCgiExternalServer directive pointing to a different instance of the application. E.g. FastCgiExternalServer /path/myapp_fastcgi.pl -host 127.0.0.1:55900 FastCgiExternalServer /path2/myapp_fastcgi.pl -host 127.0.0.1:55901 Nope. What does your Alias directive look like for this? How do you specify the other app instance (path2/myapp_fastcgi.pl)? Or do you have a different approach that doesn't use Alias? I used something like: ServerName one.example.com Alias / /path/myapp_fastcgi.pl/ ... ServerName two.example.com Alias / /path2/myapp_fastcgi.pl/ ... Anyways, I just switched over to lighttpd on a dedicated machine and the load-balancing worked perfectly within a couple of minutes :) Oh well, I guess you don't need to faff around with fastcgi anymore then ;-) Glad you have it sorted. Adeola. -- Creative Developer - Digital Craftsmen Ltd Exmouth House, 3 Pine Street London, EC1R 0JH t: +44 20 7183 1410 f: +44 20 7099 5140 m: +44 79 3952 0786 w: http://www.digitalcraftsmen.net/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/