Re: [Catalyst] script/myapp_server -r Can't exec "/usr/bin/perl" every 3 or 4 restarts
On Thu, 30 Apr 2009, Matt S Trout wrote: On Thu, Apr 30, 2009 at 02:44:05PM +0200, Erik Wasser wrote: On Tuesday 28 April 2009, Matt S Trout wrote: Two possibilities: (1) exec a $^X to print @INC to get the "normal" @INC (2) use $Config{arch} and /^5.\/ to strip off the extra ones. Thoughts? I think (1) is more bulletproof. I think a restart costs a lot of time and an additional call of $^X doesn't matter here. I think I agree. Fancy having a go at a patch? I -still- don't use -r so I -still- can't really shake such a patch out in real world usage :) My new restarter code avoids this issue entirely. It doesn't actually re-execute the initial script (which runs forever), it just restarts the web server piece (and reloads the app itself). -dave /* http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) */ ___ 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
On Fri, May 1, 2009 at 12:01 PM, wrote: > > > 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? > Yup, and also so I can easily use my file techniques outside of the main application (in another application) and from the command line. -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] 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/
Re: [Catalyst] upgraded to latest catalyst runtime 5.8 and Catalyst::Plugin::Upload::Image::Magick::Thumbnail::Fixed cant be loaded
On Fri, May 1, 2009 at 8:22 AM, wrote: > > 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). > I wouldn't touch something like this as a plugin, period. 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. I have a Model::Upload, as well as Model::Upload::Image and Model::Upload::Video -- in the controller, I just do: $c->model('Upload')->process( $upload ); Put all the important bits in the model, and let it go from there. Depending upon how you associate stuff with the users and the DB changes. My method is to actually allow multiple Models, so I have a User processor that runs after the Image/Video processor -- and that is what stores the associations in the DB. I am also actively trying to release this set of modules, but ... still some kinks to work out before it is releasable. However, this strategy has worked very well for me. -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] upgraded to latest catalyst runtime 5.8 and Catalyst::Plugin::Upload::Image::Magick::Thumbnail::Fixed cant be loaded
On 01/05/2009, at 9:22 AM, kakim...@tpg.com.au wrote: 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). Makes much more sense for the simple case. For the more complex case put it in the Model, or render up an obect as an appropriate image type in the view, like Catalyst::View::GD or Catalyst::View::Graphics::Primitive. ___ 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] Using test database with TWAM?
On Thu, Apr 30, 2009 at 05:29:12PM +0100, Iain wrote: > If your wondering why I went to all this trouble. We have several > developers so running multiple tests at the same time caused all kinds > of strange problems and nobody wanted to maintain a DB per developer! If you're using ::Fixtures and ->deploy maintaining a DB per developer is -easy-. For shadowcat clients we usually set them up with a db, per developer, per major branch. Works like a dream. -- Matt S Trout Catalyst and DBIx::Class consultancy with a clue Technical Director and a commit bit: http://shadowcat.co.uk/catalyst/ Shadowcat Systems Limited mst (@) shadowcat.co.ukhttp://shadowcat.co.uk/blog/matt-s-trout/ ___ 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] Is there a good solution of file cache? which plugin is recommended?
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? Alternatively you're welcome to sit back and enjoy the silence :) -- Matt S Trout Catalyst and DBIx::Class consultancy with a clue Technical Director and a commit bit: http://shadowcat.co.uk/catalyst/ Shadowcat Systems Limited mst (@) shadowcat.co.ukhttp://shadowcat.co.uk/blog/matt-s-trout/ ___ 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] Using test database with TWAM?
On Thu, Apr 30, 2009 at 11:42:39AM -0400, Jesse Sheidlower wrote: > > I assume this is more of a general Perl testing question than > a Catalyst question, but > > I finally sat down to write real tests for one of my apps, > with the hopes that I'll do this regularly for everything. I > was using the Tutorial chapter on testing, and the docs for > Test::WWW::Mechanize::Catalyst, for ideas. > > I quickly hit a wall because I couldn't figure out how to run > this with a test database. Since I need to test modification > and deletion stuff, but have real data, I can't just run this > against my actual app. So I figured I would dump the sql from > my production app and have my test program load this into a > database called "test-db" or whatever, having the same format > and schema as the real db, and then just drop the test db at > the end of the test. You want DBIx::Class::Fixtures for the dump/load crap, and DBIC's ->deploy method for the "dump/create the tables" stuff. Hop onto the dbix-class list if you get stuck with that part. > Unfortunately I don't know how to do this from a test script, > and I don't know how to tell TWAM to run a particular app but > with a different DBIC schema (in this case, the identical one > but with a different name, pointing to the test db) Then you want to read the ConfigLoader docs and search for LOCAL_SUFFIX for how to define a testing config. -- Matt S Trout Catalyst and DBIx::Class consultancy with a clue Technical Director and a commit bit: http://shadowcat.co.uk/catalyst/ Shadowcat Systems Limited mst (@) shadowcat.co.ukhttp://shadowcat.co.uk/blog/matt-s-trout/ ___ 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
On Thu, Apr 30, 2009 at 03:17:03PM +0100, Chisel Wright wrote: > On Thu, Apr 30, 2009 at 03:05:35PM +0100, Tomas Doran wrote: > > Catalyst::Plugin::Upload::Image::Magick contains code which says > > Catalyst::Request::Upload->mk_accessors('_image'); > > > > This is the plugin changing the core framework class, and is nasty > > action at a distance. > > > > That plugin is broken > > Yeah, I'd already come to that conclusion. > > 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. CatalystX::RoleApplicator I guess. -- Matt S Trout Catalyst and DBIx::Class consultancy with a clue Technical Director and a commit bit: http://shadowcat.co.uk/catalyst/ Shadowcat Systems Limited mst (@) shadowcat.co.ukhttp://shadowcat.co.uk/blog/matt-s-trout/ ___ 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] script/myapp_server -r Can't exec "/usr/bin/perl" every 3 or 4 restarts
On Thu, Apr 30, 2009 at 02:44:05PM +0200, Erik Wasser wrote: > On Tuesday 28 April 2009, Matt S Trout wrote: > > > Two possibilities: > > > > (1) exec a $^X to print @INC to get the "normal" @INC > > > > (2) use $Config{arch} and /^5.\/ to strip off the extra ones. > > > > Thoughts? > > I think (1) is more bulletproof. I think a restart costs a lot of time > and an additional call of $^X doesn't matter here. I think I agree. Fancy having a go at a patch? I -still- don't use -r so I -still- can't really shake such a patch out in real world usage :) -- Matt S Trout Catalyst and DBIx::Class consultancy with a clue Technical Director and a commit bit: http://shadowcat.co.uk/catalyst/ Shadowcat Systems Limited mst (@) shadowcat.co.ukhttp://shadowcat.co.uk/blog/matt-s-trout/ ___ 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] Using test database with TWAM?
On Fri, May 1, 2009 at 4:10 AM, Jesse Sheidlower wrote: > > Thanks--this is all very useful. I do not, in fact, have any > reason for a different schema; a different DSN is all I need. > > I do keep the connection details in a config file. > > I guess my question then becomes the more prosaic one of > detail, esp. as I haven't really done much with tests before: > How do I populate this database from within my test script? > How do I get my test script to use a different config file for > the test database? And Catalyst-wise, how do I run TWAM > against the version of my app that's using this other > config-file setup, either from the test server, or externally? > > Thanks. I do know there's the bit in the Testing tutorial > about using a test database, but the larger-scale things > weren't really addressed. (I'll add them to the Tutorial, if I > get good answers!) > I actually serialize out my test data into CSV files, and then use this: http://our.coldhardcode.com/jshirley/2009/01/initializing-a-database-with-d.html You can Moose this up now... it's a rather old recipe that I've been taking around with me for some time. -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] Using mysql_enable_utf8
On Fri, May 1, 2009 at 1:08 AM, Joakim Lagerqvist < joakim.lagerqv...@gmail.com> wrote: > > Just the other day I had some strange issues with MySQL and unicode. > In some rare cases it cut of strings in Lao language. It was not an > issue with the field length, rather a certain combinations of > characters. First I though I had an issue with my view, but some > trouble shooting I realized that it must be an issue with MySQL. I > I hope you at least filed a bug first. Open source software requires contributions, even in the form of bug reports, to get better. -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] Using test database with TWAM?
On Thu, Apr 30, 2009 at 03:10:13PM -0400, Jesse Sheidlower wrote: > > Thanks--this is all very useful. I do not, in fact, have any > reason for a different schema; a different DSN is all I need. > > I do keep the connection details in a config file. > > I guess my question then becomes the more prosaic one of > detail, esp. as I haven't really done much with tests before: > How do I populate this database from within my test script? I have a module that knows how to create a database and then import a database dump that's kept in svn. We use Postgresql so the module simply does a createdb and a pg_restore. The database is dropped on DESTROY after the test is run. The module sets environment variables pointing to the database it created that are then used by the test script (or really Catalyst) when the tests run. This module is used at the top of any test script that needs a database for the tests. Like Peter, I have a config file that has different sections for different "modes" of operation. Mostly used for dev, testing, qa, staging, and production configurations. I have a module that manages the configuration. That is, it's a module that you pass an application "home" directory and a "mode" and it returns a hash of the config. It's separate from Catalyst because it's used by more than just Catalyst. Now, normally the configuration for the database is defined for production, staging, etc. but for "make_test" (which is the default) the dsn is empty: make_test: database: dsn:dbi:Pg: user: password: It's possible to override the host, port, etc. if the database server is on another machine. The module that creates the test database sees this and populates the PG* environment variables, creates the database and imports the data, then the test script runs and likewise the application then uses the same PG* environment variables to access the test database. > How do I get my test script to use a different config file for > the test database? Well, mostly it's not the test script that needs the configuration data, but the application. In my case all that's needed is an environment variable that says what "mode" to run in. I have a plugin for Catalyst that loads the configuration file. It's a thin wrapper around the module that loads config data. It uses an environment variable to select the "mode", but the plugin defaults to "development", which is the more common case (when running the built in server). So, test scripts can ask for a database from a common module. That module figures out where the application home is and loads the config. It's loaded in "make_test" mode by default. Since the dsn is not set the PG* environment variables are used to tell everything what database to use. When Catalyst then goes to load the config an environment variable is set that says to use "make_test". It's probably less complex actually than my description above. ;) -- Bill Moseley. mose...@hank.org Sent from my iMutt ___ 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] Using test database with TWAM?
On Thu, Apr 30, 2009 at 11:12:39AM -0500, Peter Karman wrote: > Jesse Sheidlower wrote on 04/30/2009 10:42 AM: > > > Unfortunately I don't know how to do this from a test script, > > and I don't know how to tell TWAM to run a particular app but > > with a different DBIC schema (in this case, the identical one > > but with a different name, pointing to the test db) instead. > > Or how to do the same thing, but with TWAM hitting the app > > with the external-server method (so I can test the Apache > > deployment). > > > > Would be grateful for any pointers. > > Here's what I do. > > I have 3 different domains (environments): dev, test and prod. I > indicate which one I want with an environment variable, which defaults > to 'dev' (so if I forget, I only affect development data). > > % MY_DOMAIN=test make test > > My base db class (I use RDBO but DBIC would work just as well) checks > that env var and picks a profile to use based on the domain value. > > I maintain 3 database instances, one for each domain. I basically take a > dump of my production data via cron on a regular basis, and then import > a recent dump to my test and dev dbs as needed. That's a one-line > system() call in my test scripts in a BEGIN block. And Zbigniew Lukasiak wrote: > Hmm - first question why a different DBIC schema? Why not use the > same schema only connected to a different dsn? > And if you go that path - then you can move the connection details > (dsn) from the Catalyst model code into a config file. The final step > would be to use different config files for the tests and for the real > app. Thanks--this is all very useful. I do not, in fact, have any reason for a different schema; a different DSN is all I need. I do keep the connection details in a config file. I guess my question then becomes the more prosaic one of detail, esp. as I haven't really done much with tests before: How do I populate this database from within my test script? How do I get my test script to use a different config file for the test database? And Catalyst-wise, how do I run TWAM against the version of my app that's using this other config-file setup, either from the test server, or externally? Thanks. I do know there's the bit in the Testing tutorial about using a test database, but the larger-scale things weren't really addressed. (I'll add them to the Tutorial, if I get good answers!) Jesse ___ 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] Using test database with TWAM?
On Thu, 2009-04-30 at 11:42 -0400, Jesse Sheidlower wrote: [snip] > I quickly hit a wall because I couldn't figure out how to run > this with a test database. Since I need to test modification > and deletion stuff, but have real data, I can't just run this > against my actual app. So I figured I would dump the sql from > my production app and have my test program load this into a > database called "test-db" or whatever, having the same format > and schema as the real db, and then just drop the test db at > the end of the test. The only way I managed to do this and keep my sanity was to use the "fat model" method and then test the model layer specifically (DBIC in my case) outside of catalyst. To help with this I started using with DBICx::TestDatabase http://search.cpan.org/~jrockway/DBICx-TestDatabase-0.02/lib/DBICx/TestDatabase.pm This worked great, until I ran into problems with code relying on features of MySQL (yes I know) I then cooked up a bit (ok a lot) of a hack that relies on MySQL allowing you to create a temporary table with the same name as an existing table, the real table gets hidden. Leaving you with an empty clone of your table that disappears when you close the connection. http://dev.mysql.com/doc/refman/5.1/en/create-table.html so now when I run my tests I clone an empty DB for the duration of the test run. You have to populate it with canned data but this gives you a very consistent way to test. Again you need to be doing your heavy lifting in your model (DBIC) for this to work well. How safe this is in the long run is anybody's guess but so far its working quite well. Just don't do it on a replicating master If your wondering why I went to all this trouble. We have several developers so running multiple tests at the same time caused all kinds of strange problems and nobody wanted to maintain a DB per developer! Iain. ___ 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] Jason Kohles' tutorial on ExtJs editable data gridsandCatalyst
The error I get is : "[error] Caught exception in AdventAjaxGrid2::View::JSON->process "encountered object 'AdventAjaxGrid2 ::Model::AdventAjaxGrid2DB::Affiliation=HASH(0x91b8270)', but neither allow_blessed nor convert_blessed settings are enabled at / usr/local/share/perl/5.8.8/JSON/Any.pm line 426." I couldn't figure out how to enable those settings from the JSON-Any write up on CPAN. How is that to be done? from my limited experience, this seems to come up when you are not sending proper JSON to the JSON view. Check the code before the line: $c->detach( $c->view( 'JSON' ) ); to see what you are sending it (The error suggests you are pushing an object to it, in the calendar example he sends a reference to an array of hashes). HTH adam ___ 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] Using test database with TWAM?
On Thu, Apr 30, 2009 at 5:42 PM, Jesse Sheidlower wrote: > > I assume this is more of a general Perl testing question than > a Catalyst question, but > > I finally sat down to write real tests for one of my apps, > with the hopes that I'll do this regularly for everything. I > was using the Tutorial chapter on testing, and the docs for > Test::WWW::Mechanize::Catalyst, for ideas. > > I quickly hit a wall because I couldn't figure out how to run > this with a test database. Since I need to test modification > and deletion stuff, but have real data, I can't just run this > against my actual app. So I figured I would dump the sql from > my production app and have my test program load this into a > database called "test-db" or whatever, having the same format > and schema as the real db, and then just drop the test db at > the end of the test. > > Unfortunately I don't know how to do this from a test script, > and I don't know how to tell TWAM to run a particular app but > with a different DBIC schema (in this case, the identical one > but with a different name, pointing to the test db) instead. > Or how to do the same thing, but with TWAM hitting the app > with the external-server method (so I can test the Apache > deployment). > > Would be grateful for any pointers. Hmm - first question why a different DBIC schema? Why not use the same schema only connected to a different dsn? And if you go that path - then you can move the connection details (dsn) from the Catalyst model code into a config file. The final step would be to use different config files for the tests and for the real app. -- Zbigniew Lukasiak http://brudnopis.blogspot.com/ http://perlalchemy.blogspot.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/
Re: [Catalyst] Jason Kohles' tutorial on ExtJs editable data gridsandCatalyst
Hi, I ran into some trouble while trying to extend Jason Kohle's tutorial from a one-table database to a two-table database. The tutorial had a people table with the following columns: id, name, and affiliation. I altered the affiliation column into an affiliation_code column. And then I created another table called affiliation to hold the affiliation_code and the affiliation_description. I also specified that the affiliation_code column in the people table was a foreign key which referenced the affiliation table's primary key. I then recreated the Model in the Catalyst Application. So now the people table had a 'belongs to' relationship with the affiliation table. With this arrangement, I am able to populate the grid with data from the affiliation table, but Catalyst throws up an error when I try to populate the grid with data from the people table. The error I get is : "[error] Caught exception in AdventAjaxGrid2::View::JSON->process "encountered object 'AdventAjaxGrid2::Model::AdventAjaxGrid2DB::Affiliation=HASH(0x91b8270)', but neither allow_blessed nor convert_blessed settings are enabled at /usr/local/share/perl/5.8.8/JSON/Any.pm line 426." I couldn't figure out how to enable those settings from the JSON-Any write up on CPAN. How is that to be done? Jagdish On Mon, Apr 20, 2009 at 12:23 AM, Craig McLaughlin wrote: > > > > On Sun, 19 Apr 2009 09:35:30 +0530, jagdish eashwar > wrote: > > Hi Peter, Scott and Craig, > > Thanks a lot. Commenting out 'console.log' worked. It works irrespective > > of > > whether I use 'Catalyst.uri_for' or 'c.uri_for'. I guess that line can be > > there only if one is using firebug. And I think the tutorial code worked > > for Craig because he was using firebug. Is that right Craig? Thanks to > > Scott for being so perceptive and to Peter for being persistent. > > Yes, I am running firebug. Interesting, I hadn't realized the implications > of that line. Going to remove it now. :D > > > > > ___ > 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] Using test database with TWAM?
Jesse Sheidlower wrote on 04/30/2009 10:42 AM: > Unfortunately I don't know how to do this from a test script, > and I don't know how to tell TWAM to run a particular app but > with a different DBIC schema (in this case, the identical one > but with a different name, pointing to the test db) instead. > Or how to do the same thing, but with TWAM hitting the app > with the external-server method (so I can test the Apache > deployment). > > Would be grateful for any pointers. Here's what I do. I have 3 different domains (environments): dev, test and prod. I indicate which one I want with an environment variable, which defaults to 'dev' (so if I forget, I only affect development data). % MY_DOMAIN=test make test My base db class (I use RDBO but DBIC would work just as well) checks that env var and picks a profile to use based on the domain value. I maintain 3 database instances, one for each domain. I basically take a dump of my production data via cron on a regular basis, and then import a recent dump to my test and dev dbs as needed. That's a one-line system() call in my test scripts in a BEGIN block. Having the 3 database instances is also nice for schema dev work, as I can make changes in dev, test them with my code, and then deploy the changes to test domain, test code, repeat for prod (unless my tests are somehow destructive of data, in which case I have checks for that env var in my tests and only run in test/dev.) HTH pek -- Peter Karman . pe...@peknet.com . http://peknet.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/
Re: [Catalyst] Using mysql_enable_utf8
2009/4/29 J. Shirley : > On Wed, Apr 29, 2009 at 8:30 PM, Octavian Rasnita > wrote: >> >>> >>> I don't know why it didn't work for the first time... > > Because MySQL is evil. Just the other day I had some strange issues with MySQL and unicode. In some rare cases it cut of strings in Lao language. It was not an issue with the field length, rather a certain combinations of characters. First I though I had an issue with my view, but some trouble shooting I realized that it must be an issue with MySQL. I have now replaced MySQL with Postgres and it works fine with Lao language (as far as I can tell). best, Joakim ___ 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] Is there a good solution of file cache? which plugin is recommended?
Malloy wrote: I think your forgot to explain what problem you would like solved. 'file cache' isn't very clear. I guess you probably want Catalyst::Plugin::PageCache however. 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/
[Catalyst] Is there a good solution of file cache? which plugin is recommended?
-- Jack Malloy ___ 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] Using test database with TWAM?
I assume this is more of a general Perl testing question than a Catalyst question, but I finally sat down to write real tests for one of my apps, with the hopes that I'll do this regularly for everything. I was using the Tutorial chapter on testing, and the docs for Test::WWW::Mechanize::Catalyst, for ideas. I quickly hit a wall because I couldn't figure out how to run this with a test database. Since I need to test modification and deletion stuff, but have real data, I can't just run this against my actual app. So I figured I would dump the sql from my production app and have my test program load this into a database called "test-db" or whatever, having the same format and schema as the real db, and then just drop the test db at the end of the test. Unfortunately I don't know how to do this from a test script, and I don't know how to tell TWAM to run a particular app but with a different DBIC schema (in this case, the identical one but with a different name, pointing to the test db) instead. Or how to do the same thing, but with TWAM hitting the app with the external-server method (so I can test the Apache deployment). Would be grateful for any pointers. Thanks. Jesse Sheidlower ___ 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] Using mysql_enable_utf8
I set init_connect=utf8 in my.cnf. 2009/4/29 Octavian Rasnita > Hi, > > I need to use C::M::DBI for a fulltext index with MySQL, and the tables > contain UTF-8 data. > > I found that I can use mysql_enable_utf8 but I couldn't find how to use > this option. > > I've tried to use it in the model in 2 places as: > > __PACKAGE__->config( > dsn => 'dbi:mysql:database=intranet', > user => 'root', > password => undef, > options => { > mysql_enable_utf8 => 1, > }, > mysql_enable_utf8 => 1, > ); > > And I also tried to use it in the controller as > > $dbh->{mysql_enable_utf8} = 1; > > But with no success. The data still appears not encoded to UTF-8. > > What am I doing wrong? Or do I need to make some other configurations? > > ---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/ > -- Jack Malloy ___ 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
On Thu, Apr 30, 2009 at 03:05:35PM +0100, Tomas Doran wrote: > Catalyst::Plugin::Upload::Image::Magick contains code which says > Catalyst::Request::Upload->mk_accessors('_image'); > > This is the plugin changing the core framework class, and is nasty > action at a distance. > > That plugin is broken Yeah, I'd already come to that conclusion. 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. Chisel -- Chisel Wright e: chi...@herlpacker.co.uk w: http://www.herlpacker.co.uk/ It's not dead, it's just resting! ___ 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] website member urls
J. Shirley wrote: If you did want to do something in Catalyst, you could create a plugin that runs after prepare_path and modifies $c->request->path accordingly (match off $c->req->base domain)... it'd be an interesting plugin, that's for sure. I'm sure some of the deeper Catalyst hackers can think of alternative, and perhaps simpler, ways to do it. package MyApp::RequestRole::PrependHostName; use Moose::Role; around path => sub { my ($orig, $self, @path) = @_; return $self->$orig() if ! @path; $self->$orig($self->hostname, @path)); }; package MyApp; use Moose; use Catalyst; use Catalyst::App::RoleApplicator; __PACKAGE__->apply_request_class_roles( qw/MyApp::RequestRole::PrependHostName/ ); I think would do what you want (untested). I am unsure if this is a sane approach however, but that has already been covered elsewhere in the thread. :_) 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] upgraded to latest catalyst runtime 5.8 and Catalyst::Plugin::Upload::Image::Magick::Thumbnail::Fixed cant be loaded
kakim...@tpg.com.au wrote: " 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? ". Catalyst::Plugin::Upload::Image::Magick contains code which says Catalyst::Request::Upload->mk_accessors('_image'); This is the plugin changing the core framework class, and is nasty action at a distance. That plugin is broken: http://rt.cpan.org/Public/Bug/Display.html?id=45188 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] upgraded to latest catalyst runtime 5.8 and Catalyst::Plugin::Upload::Image::Magick::Thumbnail::Fixed cant be loaded
On Thu, Apr 30, 2009 at 11:40:47PM +1000, kakim...@tpg.com.au wrote: > 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 Yeah, I stumbled across this the other day and added output to the RT ticket: https://rt.cpan.org/Ticket/Display.html?id=45188 I had a quick look but wasn't sure how to resolve the issue (properly). Chiz -- Chisel Wright e: chi...@herlpacker.co.uk w: http://www.herlpacker.co.uk/ Pink is my favourite crayon ___ 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] script/myapp_server -r Can't exec "/usr/bin/perl" every 3 or 4 restarts
On Tuesday 28 April 2009, Matt S Trout wrote: > Two possibilities: > > (1) exec a $^X to print @INC to get the "normal" @INC > > (2) use $Config{arch} and /^5.\/ to strip off the extra ones. > > Thoughts? I think (1) is more bulletproof. I think a restart costs a lot of time and an additional call of $^X doesn't matter here. -- So long... Fuzz ___ 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] Scalable Catalyst
Alejandro Imass wrote: Anyway, the message is that with mod_worker/mod_perl you can spawn _thousands_ of threads, getting impressive concurrency (without counting the mutex). We have tested Catalyst applications that handle _thousands_ of concurrent requests using off the shelf AMD 64Bit HW and 12Gb RAM, with a Catalyst app of about 20MB RSS. There is a big difference between having thousands of requests in-flight at once, and serving thousands of new requests a second. You're saying that mod_worker can do the former well, without mentioning the latter. I'd very much guess that in your configuration, most of your workers (and requests) are just pushing bytes to the user, which isn't really a hard job.. :_) The reason that normal mod_perl fails at this is you have one process per request, and so having many many requests in flight at once hurts. However, if you have thousands of requests all trying to generate pages at once, you're going to fail and die - full stop... perl -e'system("perl -e\"while (1) {}\" \&") for (1..1000)' will convince you of this if you aren't already :) You can trivially get round this by having a _small_ number of mod_perl processes behind a proxy, so that your (expensive/large) mod_perl process generates a page, then throws it at network speed (1Gb/s or higher if you're on localhost) to the proxy, which then streams it to the user much much slower. This frees up your mod_perl processes as quickly as possible to be getting on with useful work. I'd also note that having more threads/processes generating pages than you have CPU cores is fairly inefficient, as the more processes you have, the greater the penalty you're going to incur due to increased context switching overhead. ( Quite often you block on the database in most apps, which means that 1 process per CPU core doesn't hold totally true for best throughput, so YMMV.. For the record, one of my apps can trivially do 200 requests a second, with 3000+ concurrent requests in-flight, using a single 4Gb dual core x64 box with one disk, running both the application _and_ the mysql server.. It flattens the 100Mb pipe to the internet I have in the office waaay before the system actually starts to struggle from a load perspective.. That's nginx / fastcgi with 3 fcgi worker processes (no of cores +1) - when benchmarking I found this most efficient for that application. This is one of the things that your mileage varies significantly, depending on what your application is doing, and anyone else's answer is going to be lies - you _need_ to test and optimise it yourself for your app and your workload. :) 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] website member urls
It could be also helpful if we could find a way to create urls like http://user.hostname.com/ dynamicly as Google blogger site does. We do this with a wildcard A record in the DNS and an Apache URL rewriting rule that moves the hostname into the path. When I started writing my app (in Catalytic pre-history) there wasn't any support (that I could see) in Catalyst for using the hostname in the rules that decide when an action is invoked and what parameters to pass to it. Things have moved on a lot since then though so perhaps the URL rewriter could be replaced with a better action description now. Merlyn If others don't know more about a newer and better way as you suggested, can you give some hints about the way you told about? It's pretty simple. The wildcard A record in the DNS just makes sure that all requests for http://.ourdomain.com/ are sent to the server. The Apache URL rewriter goes in the Apache config file and is basically a piece of code, typically like a perl s/// regexp, that hacks the URL up a bit so that, for example, http://anything.ourdomain.com/path might be presented to the back end as http://ourdomain.com/ouraction/anything/path or whatever suits you. See http://httpd.apache.org/docs/2.0/misc/rewriteguide.html for more info on Apache URL rewriting. The idea I had about Catalyst supporting this more directly was just that there might be something like the PathPart() thing that would so something similar with the hostname so you could say something like: sub handler : Chained('/') HostPart(something) CaptureArgs(1) {} but from what J.Shirley said in another message it sounds like there is no such thing. I'm afraid that's all a bit beyond me though - all my Catalyst apps were started before the introduction of PathPart() and getting up to date is still on my job list... Merlyn ___ 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] website member urls
On Thu, Apr 30, 2009 at 7:14 PM, Octavian Rasnita wrote: > *From:* Merlyn Kline > > > > It could be also helpful if we could find a way to create urls like > > http://user.hostname.com/ > > dynamicly as Google blogger site does. > > We do this with a wildcard A record in the DNS and an Apache URL rewriting > rule that moves the hostname into the path. When I started writing my app > (in Catalytic pre-history) there wasn't any support (that I could see) in > Catalyst for using the hostname in the rules that decide when an action is > invoked and what parameters to pass to it. Things have moved on a lot since > then though so perhaps the URL rewriter could be replaced with a better > action description now. > Merlyn > > > > > If others don't know more about a newer and better way as you suggested, > can you give some hints about the way you told about? > > > > Thanks. > > > > Octavian > > > > I don't see much reason for this to be inside of Catalyst, because the only way to properly test is to stuff the Host: header with the data... that could get a bit weird. Instead, what you can easily do is just setup a rewrite rule in your front-end webserver and translate the path accordingly (this is fairly common). If you did want to do something in Catalyst, you could create a plugin that runs after prepare_path and modifies $c->request->path accordingly (match off $c->req->base domain)... it'd be an interesting plugin, that's for sure. I'm sure some of the deeper Catalyst hackers can think of alternative, and perhaps simpler, ways to do it. I would highly recommend doing it at the webserver level, though... Catalyst's uri_for would generate URIs like ' www.myapp.com/user/$foo/whatever' rather than $foo.myapp.com/whatever, but that is the only drawback I can see. -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] website member urls
From: Merlyn Kline It could be also helpful if we could find a way to create urls like http://user.hostname.com/ dynamicly as Google blogger site does. We do this with a wildcard A record in the DNS and an Apache URL rewriting rule that moves the hostname into the path. When I started writing my app (in Catalytic pre-history) there wasn't any support (that I could see) in Catalyst for using the hostname in the rules that decide when an action is invoked and what parameters to pass to it. Things have moved on a lot since then though so perhaps the URL rewriter could be replaced with a better action description now. Merlyn If others don't know more about a newer and better way as you suggested, can you give some hints about the way you told about? Thanks. 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/
RE: [Catalyst] website member urls
It could be also helpful if we could find a way to create urls like http://user.hostname.com/ dynamicly as Google blogger site does. We do this with a wildcard A record in the DNS and an Apache URL rewriting rule that moves the hostname into the path. When I started writing my app (in Catalytic pre-history) there wasn't any support (that I could see) in Catalyst for using the hostname in the rules that decide when an action is invoked and what parameters to pass to it. Things have moved on a lot since then though so perhaps the URL rewriter could be replaced with a better action description now. Merlyn ___ 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/