Re: [Catalyst] user maintenance
Adam Bartosik wrote: MySQL 4.x and 5.0 will accept the above SQL syntax, but will silently ignore it, and not actually perform any referential integrity checking, nor cascading. ie. It all looks like it's working fine, until it breaks horribly when you get into detailed testing. You have been warned. Please, please RTFM before writing such things, eg: http://dev.mysql.com/tech-resources/articles/mysql-enforcing-foreign-keys.html It is better to know how stuff works - there are different formats of tables (storages) in MySQL so you can use what is better for your needs and defaults are not always the best. It just like flexibility in Catalyst compared to ... Rails? Attached are two SQL files. One of them uses default MySQL tables, the other one creates them as InnoDB tables. I have run them against MySQL 5 and in both cases, the foreign key constraints and cascading deletes are silently ignored. How is that better for your needs? You're welcome to verify this yourself. I include the captured output too, although it'll make more sense if you look at the SQL first. I also include the output from running the normal SQL through Postgres 8, and you can see the difference - the cascading delete occurs, and an error is thrown when an invalid foreign key is inserted. Note: I am aware that there are workarounds available to make MySQL overcome these limitations - however, I stand by the belief that it is harmful that MySQL silently ignores the standard SQL syntax. -Toby CREATE TABLE accounts ( id INTEGER PRIMARY KEY, username VARCHAR(32) ); CREATE TABLE roles ( role VARCHAR(32) PRIMARY KEY ); CREATE TABLE accounts_to_roles ( account INTEGER NOT NULL REFERENCES accounts(id) ON DELETE CASCADE, roleVARCHAR(32) NOT NULL REFERENCES roles(role) ON DELETE CASCADE, PRIMARY KEY(account,role) ); BEGIN; INSERT INTO accounts(id, username) VALUES (1, 'Toby'); INSERT INTO accounts(id, username) VALUES (2, 'Bob'); INSERT INTO roles(role) VALUES ('Admin'); INSERT INTO roles(role) VALUES ('Luser'); COMMIT; BEGIN; -- Test cascading delete: INSERT INTO accounts_to_roles (account, role) VALUES (2, 'Luser'); DELETE FROM accounts WHERE id=2; SELECT * FROM accounts_to_roles; COMMIT; BEGIN; -- Test foreign key constraint: INSERT INTO accounts_to_roles(account, role) VALUES (1, 'Admin'); INSERT INTO accounts_to_roles(account, role) VALUES (1, 'Fake'); INSERT INTO accounts_to_roles(account, role) VALUES (3, 'Unreal'); SELECT * FROM accounts_to_roles; COMMIT; CREATE TABLE accounts ( id INTEGER PRIMARY KEY, username VARCHAR(32) ) ENGINE=InnoDB; CREATE TABLE roles ( role VARCHAR(32) PRIMARY KEY ) ENGINE=InnoDB; CREATE TABLE accounts_to_roles ( account INTEGER NOT NULL REFERENCES accounts(id) ON DELETE CASCADE, roleVARCHAR(32) NOT NULL REFERENCES roles(role) ON DELETE CASCADE, PRIMARY KEY(account,role) ) ENGINE=InnoDB; BEGIN; INSERT INTO accounts(id, username) VALUES (1, 'Toby'); INSERT INTO accounts(id, username) VALUES (2, 'Bob'); INSERT INTO roles(role) VALUES ('Admin'); INSERT INTO roles(role) VALUES ('Luser'); COMMIT; BEGIN; -- Test cascading delete: INSERT INTO accounts_to_roles (account, role) VALUES (2, 'Luser'); DELETE FROM accounts WHERE id=2; SELECT * FROM accounts_to_roles; COMMIT; BEGIN; -- Test foreign key constraint: INSERT INTO accounts_to_roles(account, role) VALUES (1, 'Admin'); INSERT INTO accounts_to_roles(account, role) VALUES (1, 'Fake'); INSERT INTO accounts_to_roles(account, role) VALUES (3, 'Unreal'); SELECT * FROM accounts_to_roles; COMMIT; mysql \. test.sql Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.02 sec) Query OK, 0 rows affected (0.01 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 1 row affected (0.02 sec) Query OK, 1 row affected (0.00 sec) Query OK, 1 row affected (0.00 sec) Query OK, 1 row affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 1 row affected (0.00 sec) Query OK, 1 row affected (0.00 sec) +-+---+ | account | role | +-+---+ | 2 | Luser | +-+---+ 1 row in set (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 1 row affected (0.01 sec) Query OK, 1 row affected (0.00 sec) Query OK, 1 row affected (0.00 sec) +-++ | account | role | +-++ | 1 | Admin | | 1 | Fake | | 2 | Luser | | 3 | Unreal | +-++ 4 rows in set (0.00 sec) Query OK, 0 rows affected (0.00 sec) mysql mysql \. test-innodb.sql Query OK, 0 rows affected (0.04 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.01 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 1 row affected (0.00 sec) Query OK, 1 row affected (0.00 sec) Query OK, 1 row affected (0.00 sec) Query OK, 1 row affected (0.00 sec) Query OK, 0 rows affected (0.01
Re: [Catalyst] user maintenance
Michael Higgins wrote: Hello, list -- I have a catalyst app about to get a bunch of new users. In anticipation of that, I'd like advice on how to maintain the user/acl tables I set up per the tutorial. Basically, I just want to add the user and have a default role automagically appear in the corresponding acl table. When I delete the user, the user's role(s) go as well. Which of the catalyst options would give me the quickest route to maintaining this list? And what is the best way to ... create related entries and cascade delete? (I'm still new at this.) Are you using MySQL? If so, stop using it, and start using a relational database that supports foreign keys and cascaded deletes - and example of an opensource DB with those is PostgreSQL. Then define your tables like: CREATE TABLE accounts ( id SERIAL PRIMARY KEY, username VARCHAR(32) -- etc ); CREATE TABLE roles ( id SERIAL PRIMARY KEY, role VARCHAR(32) -- note: some people just use the role AS the primary key on its own ); CREATE TABLE accounts_to_roles ( account INTEGER NOT NULL REFERENCES accounts(id) ON DELETE CASCADE, roleINTEGER NOT NULL REFERENCES roles(id) ON DELETE CASCADE, PRIMARY KEY(account,role) ); Then setup your DBIx::Class schema with the appropriate relationships - ie. AccountsToRoles.pm has: # the usual stuff, then: __PACKAGE__-belongs_to(account = 'MyApp::Schema::Accounts'); __PACKAGE__-belongs_to(role = 'MyApp::Schema::Roles'); Accounts.pm has # the usual stuff __PACKAGE__-has_many( account_roles = 'MyApp::Schema::AccountsToRoles', 'account' ); __PACKAGE__-many_to_many( roles = 'account_roles', 'role' ); After all that, you should be able to use Catalyst::Plugin::Authentication and C:P:Authorization::Roles with it all, and you'll find that when you delete accounts, or roles, the corresponding entry in the linking table deletes as well. MySQL 4.x and 5.0 will accept the above SQL syntax, but will silently ignore it, and not actually perform any referential integrity checking, nor cascading. ie. It all looks like it's working fine, until it breaks horribly when you get into detailed testing. You have been warned. (I believe there is a MySQL-specific workaround for this, but like the horribleness with timestamps, it seems more trouble than just using a DB that just works, as there are plenty of commercial, and at least one open-source DBs that support the standard way) Cheers, Toby ___ 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] (en) error screen translations
Jonathan Rockway wrote: Here's the list: (en) Please come back later (fr) SVP veuillez revenir plus tard (de) Bitte versuchen sie es spaeter nocheinmal (at) Konnten's bitt'schoen spaeter nochmal reinschauen (no) Vennligst prov igjen senere (dk) Venligst prov igen senere (pl) Prosze sprobowac pozniej (pt) Por favor, volte mais tarde (ja) 後ほどお越しください (el) Παρακαλούμε ξαναελάτε αργότερα. (ro) Vă rugăm să reveniţi mai târziu. (he) אנא שובו במועד מאוחר יותר (cn) 请稍后再来 (lb) Kommt w.e.g. spéider nach eng Kéier zeréck. (bg) Моля, опитайте след малко (bø) børk børk børk! Anything else? The thought has occurred to me that we should order these by popularity. Quenya and Sindarin? I'll see if I can get them. Toby ___ 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] A Perl Message Queue?
Pedro Melo wrote: Hi, On Aug 25, 2007, at 4:07 AM, Jonathan Rockway wrote: Bernhard Graf wrote: Don't know about TheSchwartz (btw. what a stupid name) When you write your own message queue that actually works correctly, is supported and documented, and is available freely on the CPAN, you can pick the name. In the mean time, STFU. Thanks. Besides, use TheSchwartz; Please tell me there's a function, optionally exported, called Lone_Starr? at the top of a program immedialy makes your script look cool. We need a MegaMaid now. Best regards, ___ 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] Gentoo portage overlay
Matt S Trout wrote: On Mon, Jul 23, 2007 at 10:56:07AM +0200, Michele Beltrame wrote: Hello! I've been travelling for quite a while and am now on the other side of the world, but am back at work on Catalyst-based apps, and re-subbed to the list. Anyway, I just wondered who was maintaining the Gentoo portage Catalyst overlay, as I have a couple of ebuilds for them. I am the main mnt, however SVN repository is on a Shadowcat server, so just ask mst for the commit bit! Right, just lob me an htpasswd line off-list and I'll get you set up. Cheers. The ebuilds for CPAuthentication and CPA:DBIC have been committed, although marked as unstable since I gather there are still some compatibility issues and we don't want to surprise people.. Oh, can somebody fix the digest for DBIC 08003 please? It looks like somebody took the first tarball I posted on trout.me.uk to checksum rather than the one that was actually released. I checked, but it looks like someone has already fixed it by now. -Toby ___ 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] Gentoo portage overlay
Hi guys, I've been travelling for quite a while and am now on the other side of the world, but am back at work on Catalyst-based apps, and re-subbed to the list. Anyway, I just wondered who was maintaining the Gentoo portage Catalyst overlay, as I have a couple of ebuilds for them. -Toby # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header$ inherit perl-module DESCRIPTION=Infrastructure plugin for the Catalyst authentication framework HOMEPAGE=http://search.cpan.org/dist/${PN}/; SRC_URI=mirror://cpan/authors/id/N/NU/NUFFIN/${P}.tar.gz RESTRICT=nomirror IUSE= SLOT=0 LICENSE=|| ( Artistic GPL-2 ) KEYWORDS=alpha amd64 arm hppa ia64 m68k mips ppc ppc64 ppc-macos s390 sh sparc x86 DEPEND= dev-perl/Catalyst-Runtime =dev-perl/Catalyst-Plugin-Session-0.10 dev-perl/Class-Inspector # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header$ inherit perl-module DESCRIPTION=Authentication and authorization against a DBIx::Class schema SRC_URI=mirror://cpan/authors/id/J/JA/JAYK/${P}.tar.gz HOMEPAGE=http://search.cpan.org/dist/${PN}/; RESTRICT=nomirror IUSE= SLOT=0 LICENSE=|| ( Artistic GPL-2 ) KEYWORDS=alpha amd64 arm hppa ia64 m68k mips ppc ppc64 ppc-macos s390 sh sparc x86 DEPEND=dev-perl/module-build dev-perl/Catalyst-Runtime =dev-perl/Catalyst-Plugin-Authentication-0.10 dev-perl/DBIx-Class ___ 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] Apache2+fcgid or Lighttpd
Daniel McBrearty wrote: I thought of using fcgi also, but wondered if the fact that lighty doesn't make the fcgi connection persistent was significant. Are you sure? It looked persistent to me. On 3/15/07, Michele Beltrame [EMAIL PROTECTED] wrote: I'm about to deploy an application, and this time I can choose to use Lightpd instead of Apache+fcgid, which I commonly use. I have no problem with the latter configuration, but I was wondering if someone has comments/experience about Lighttpd for running Catalyst applications, i.e. speed, memory footprint, etc... I swapped over to lighttpd and am currently impressed - it seems to perform better than Apache under high numbers of concurrent connections due to its non-forking architecture. ie. Where apache would spawn more and more processes, chew loads of memory, and then hit MaxClients and stop accepting connections, Lighttpd seems to keep on truckin' and queuing them up. Toby ___ 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] Dreamhost for Catalyst
I thought I'd follow this up a bit later with my results. I bought an account at ASmallOrange, and had a Catalyst FastCGI setup running rapidly. There was a minor hiccup, in that for some reason /usr/bin/ld wasn't user executable, but a support email asking about it was answered in about 5 minutes, and they fixed it. The system I'm on seems very responsive, and seems to have, on average, only 2-3 users on it at once. Compiling all the Perl modules flew by on what appears to be a 2.1 GHz Core2Duo Linux system. Pity about the lack of Postgres, but I can confirm I've got MySQL 5 and SQLite 3. Toby Danny Warren wrote: I have native postgres 7.5.x and fcgi on the server I sit on. The only thing I have compiled in my account space are the catalyst libs + a few plugins + plugin/catalyst deps (which they would also install for you to the base system if you asked, but I didn't mind doing that myself right now). Oh wait, I just searched their forums and found this: http://forums.asmallorange.com/index.php?showtopic=8200 Lame, it looks like postgres support is no longer official, hence why you didn't see it on the site. I knew that only a handful of people (out of hundreds of users) cared about postgres, so from that perspective I can understand not supporting it (especially when they care about keeping things patched and current all the time). Apparently postgres just doesn't play well with cpanel, which I have experienced myself. It looks like the reason I have postgres is just because I am an older customer and they won't take it *away*, they just aren't actively supporting it. I do know the fastcgi libs are everywhere, since every box has a ruby on rails setup going using fcgi (they have an apachehandler for .fcgi - fastcgi by default). My server just lacked the fcgi perl module which myapp_fastcgi.pl needs to run. I might e-mail them to see if they would be willing to maybe have at least one of their servers config'd with postgres, for the handful of us who use it going forward. (FYI, I am hosted on the lamda server, if you want to make sure you get all the same stuff I have, not sure if they are putting new customers on that box) Danny Toby Corkindale wrote: Danny Warren wrote: Here is the part where you get flooded with host recommendations from everyone! I use these guys: http://asmallorange.com/ [snip] I was able to compile everything else I needed for catalyst in my home dir, and had a fastcgi + catalyst setup going without any problems. They also seemed interested in making Catalyst available by default, which would be really cool. I haven't circled back and talked to them about that yet (I was just trying to make sure that it worked in the first place before I totally dove in to catalyst). Here is the test page, running under fcgi and connecting to postgres: That is good! I couldn't see anything the the smallorange sales pages about them supporting postgres or fastcgi, but if they support it, that's excellent, and what I'm after. Are you running PostgreSQL in your own account space, or are you connecting to some shared database on their servers? asmallorange definately appear to be running much newer versions of software than dreamhost, which is nice. Cheers Toby ___ 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] Dreamhost for Catalyst
Danny Warren wrote: Here is the part where you get flooded with host recommendations from everyone! I use these guys: http://asmallorange.com/ [snip] I was able to compile everything else I needed for catalyst in my home dir, and had a fastcgi + catalyst setup going without any problems. They also seemed interested in making Catalyst available by default, which would be really cool. I haven't circled back and talked to them about that yet (I was just trying to make sure that it worked in the first place before I totally dove in to catalyst). Here is the test page, running under fcgi and connecting to postgres: That is good! I couldn't see anything the the smallorange sales pages about them supporting postgres or fastcgi, but if they support it, that's excellent, and what I'm after. Are you running PostgreSQL in your own account space, or are you connecting to some shared database on their servers? asmallorange definately appear to be running much newer versions of software than dreamhost, which is nice. Cheers Toby ___ 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] Dreamhost for Catalyst
Thomas Hartman wrote: I use dreamhost as an easy way to get wikis/svn/other goodies running. Svn with web access is especially nice, still haven't figured out how to install this on my real server (at linode). However, for actual catalyst websites, I have a virtual server at linode.com, where I have a root account for less than $20/month. However, I think you will get people telling you that it is possible, they do it all the time for their clients, etc. So maybe I'm just an install wuss. But... my experience was definitely better with a virtual root server. *nods* I prefer having a virtual (root) server (or even a proper colo'ed machine) too, but it all depends on budget and maintenance time. I'm wanting to migrate a small community application I run (and resurrect another older one) away from my ADSL, along with my email and domains.. but don't really see the need to spend more money for a virtual server that'll require more time to maintain. That's the theory.. maybe I should stop being a cheaparse and just spend more though.. I admin quite a lot of production servers, and losing that full control will probably make me all twitchy, even if only for a little community site. :) Toby On 2/14/07, Jim Spath [EMAIL PROTECTED] wrote: I would stay away from Dreamhost personally. Regardless of what they happen to support, I've had numerous performance + uptime issues with them. You might look into slicehost. It's a little more expensive, but you essentially get your own machine (via Xen VPS), allowing you install and run whatever you want on it. - Jim Toby Corkindale wrote: Toby Corkindale wrote: Hi guys, was chatting to someone about hosting a low-traffic Catalyst site, and the subject of Dreamhost came up - they (apparently) offer particularly cheap virtual servers (about £5/month), and judging by their website, you receive a shell and can compile your own apps, including it says, CGI apps. I was wondering how appropriate it would be for running a database-backed Catalyst app though. There is support for persistent MySQL databases (i don't know about PostgreSQL), but I don't know about mod_perl or fastcgi apps. Edit: No support for mod_perl, nor PostgreSQL. However, there IS support for FastCGI. ___ 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/ ___ 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/ ___ 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] Dreamhost for Catalyst
Hi guys, was chatting to someone about hosting a low-traffic Catalyst site, and the subject of Dreamhost came up - they (apparently) offer particularly cheap virtual servers (about £5/month), and judging by their website, you receive a shell and can compile your own apps, including it says, CGI apps. I was wondering how appropriate it would be for running a database-backed Catalyst app though. There is support for persistent MySQL databases (i don't know about PostgreSQL), but I don't know about mod_perl or fastcgi apps. Has anyone else tried using them? You don't get a unique IP address, so I suspect you don't get your own Apache instance either, so that probably rules out mod_perl. I guess I could always have a CGI-only version of the catalyst app, but catalyst takes quite a while to load up on bigger apps.. Cheers, Toby ___ 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] Dreamhost for Catalyst
Toby Corkindale wrote: Hi guys, was chatting to someone about hosting a low-traffic Catalyst site, and the subject of Dreamhost came up - they (apparently) offer particularly cheap virtual servers (about £5/month), and judging by their website, you receive a shell and can compile your own apps, including it says, CGI apps. I was wondering how appropriate it would be for running a database-backed Catalyst app though. There is support for persistent MySQL databases (i don't know about PostgreSQL), but I don't know about mod_perl or fastcgi apps. Edit: No support for mod_perl, nor PostgreSQL. However, there IS support for FastCGI. ___ 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] Preferred Ajax framework
Mesdaq, Ali wrote: Hello everyone new to the list and new to catalyst in general. I am still trying to figure out best ways of using it in our environment with least amount of pain. To do that I am trying to plan it out before I start really getting my hands dirty. My question is what is everyone's preferred Ajax framework? There are tons of them out there but which one in your experience is the best. A little short reason would also be appreciated to see if my priorities line up with your reasons. Dojo. In theory you can let non-programmers edit your templates, and they can understand using Dojo widgets, because they look like HTML tags. Also, lots of things are already available as widgets, so you don't have to code them yourself. Downsides: Can get quite slow to load pages. Documentation is either lacking or totally incorrect for many pages. Attempts to correct said documentation by me failed, as you need to sign a disclosure saying your contributions are owned by the Dojo Foundation (so they can publish a book later) - and frankly, I wasn't going to put in the amount of effort required to do the application and disclosure signing, just to correct them. Emails to the appropriate devs appeared didn't achieve much, I noted when the .4 release was out. So expect to read the source code to figure out how to use it.. Which then negates the benefit I just gave of non-programmers can use the widgets. We've got a large amount of complex pages invested in Dojo now though, so we're probably going to continue to use it for a while. The doco situation is slowly improving though. Toby ___ 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: (off-topic) Re: [Catalyst] Preferred Ajax framework
Carl Franks wrote: On 11/01/07, Toby Corkindale [EMAIL PROTECTED] wrote: ... Attempts to correct said documentation by me failed, as you need to sign a disclosure saying your contributions are owned by the Dojo Foundation (so they can publish a book later) ... The CLA ( http://dojotoolkit.org/icla.txt ) grants them a copyright license for your work. The work is still owned by you... Except for the license granted herein to the Foundation and recipients of software distributed by the Foundation, You reserve all right, title, and interest in and to Your Contributions. You could dispute its commercial use... the Foundation shall not use Your Contributions in a way that is ... inconsistent with its nonprofit status After I faxed them the CLA they commited my previous submissions, with no problems. I didn't have a problem with the CLA itself.. I just couldn't be bothered to actually go through with the procedure to sign it. (I only found out after I submitted stuff, so it's wasted time, but I didn't want to waste any more either.) ___ 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] Dojo madness
I'm totally stumped. I have two extremely simple webpages, one of which causes IE to crash with an error Operation aborted, and another that works fine. The only difference between them is the use of a base tag in the header. $ diff breaks.html works.html 5d4 base href=http://wtf.ymogen.net/; / I have put the files online, in case anyone wants to test this out on their own browsers: http://wtf.ymogen.net/ (Note that Dojo 0.3.1 is extracted into a sub-directory called dojo, in case anyone wants to make their own setup. Or just wget -r the lot.) I'll hunt down the Dojo mailing list next and post there, but thought I'd post this here for your WTF confusement first. Toby -- Turning and turning in the widening gyre/The falcon cannot hear the falconer; Things fall apart, the centre cannot hold/Mere anarchy is loosed upon the world (gpg --keyserver www.co.uk.pgp.net --recv-key B1CCF88E) ___ 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] Documentation bug in Catalyst::Request
Bug in Catalyst::Request. It says: $req-action Returns the requested action as a Catalyst::Action object. However, it just returns the action, (ie. foo/bar). To get a genuine Catalyst::Action object, you need to call $c-action. I'd want to keep backwards compatibility, so maybe note in C::R that the method returns the equivelent of $c-action-action, and that you might want to investigate calling $c-action if you want a Catalyst::Action object. -Toby -- Turning and turning in the widening gyre/The falcon cannot hear the falconer; Things fall apart, the centre cannot hold/Mere anarchy is loosed upon the world (gpg --keyserver www.co.uk.pgp.net --recv-key B1CCF88E) ___ 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] C::P::PageCache patch for reducing duplicate processing
Perrin Harkins wrote: On Thu, 2006-06-22 at 14:01 -0500, [EMAIL PROTECTED] wrote: Or have the first hit after the expire set the expire time counter to the next interval so the next hit does not even think to rebuild. Then you can also rebuild the cache to a temp name and overwrite the current cache when it is complete. This way to sleeping is required on long building pages with many hits (they all just serve the old page until the new one overwrites in an atomic write). FYI, that's how Mason does it. What is the behaviour for the first and second requests, before there is *any* cached content available? tjc ___ 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] C::P::PageCache patch for reducing duplicate processing
Perrin Harkins wrote: Toby Corkindale wrote: Perrin Harkins wrote: FYI, that's how Mason does it. What is the behaviour for the first and second requests, before there is *any* cached content available? In Mason? The same as any other request for un-cached content. You can read the code and docs here: http://search.cpan.org/src/DROLSKY/HTML-Mason-1.33/lib/HTML/Mason/Cache/BaseCache.pm Ta. One of the aims of my patch is to avoid the expense of having numerous processes produce the same code simultaneously. So on the initial bunch of requests, I'll still try and have the code delay all-but-one of them from building the page. Toby ___ 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] C::P::PageCache patch for reducing duplicate processing
Hi, There's a patch attached for Catalyst::Plugin::PageCache. (It's not final, but more a request for comments on it so far. In particular, some better way than using flock()) PageCache's objective is to let you cache pages that are heavy to create. However, the potential exists for a page to expire, and then for several requests to come in at once for it near-simultaneously. Since the first query hasn't completed building the page yet, the subsequent queries will all go off and try to build the same page too. If that page is rather expensive, this is detrimental to performance. The object of the patched version is to prevent your application from regenerating cached pages in parallel - instead, it forces the subsequent requests to wait until the first query has built the page, and then uses that. This will tie up some apache processes waiting on a lock for a while, but will reduce the unnecessarily-duplicated CPU or database load that would otherwise have occurred. -Toby --- PageCache.pm 2006-03-09 21:30:16.0 + +++ New.pm 2006-06-22 18:24:58.0 +0100 @@ -3,6 +3,8 @@ use strict; use base qw/Class::Accessor::Fast/; use NEXT; +use Digest::MD5 qw/md5_hex/; +use Fcntl ':flock'; our $VERSION = '0.12'; @@ -16,6 +18,9 @@ # user changes them during processing __PACKAGE__-mk_accessors('_page_cache_key'); +# For storing the lock file we use (Toby) +__PACKAGE__-mk_accessors('_page_cache_lock_file'); + sub cache_page { my ( $c, @args ) = @_; @@ -43,6 +48,10 @@ # mark the page for caching during finalize if ( $expires 0 ) { $c-_cache_page( { cache_seconds = $expires } ); +# Toby: don't build any other identical pages in the meantime.. +# never cache POST requests +$c-_page_cache_set_is_building($c) unless ($c-req-method eq POST); +# /Toby } } @@ -77,11 +86,14 @@ # check the page cache for a cached copy of this page my $key = $c-_get_page_cache_key; +# Toby +$c-_page_cache_check_if_building( $key ); +# /Toby + return $c-NEXT::dispatch(@_) unless my $data = $c-cache-get( $key ); - # Time to remove page from cache? if ( $data-{expire_time} = time ) { @@ -104,6 +116,9 @@ $c-_page_cache_used( 1 ); +# Toby: We can remove the lock now: +$c-_page_cache_remove_file; + # Check If-Modified-Since headers return 1 if $c-_page_cache_not_modified( $data ); @@ -246,7 +261,14 @@ # Check for If-Modified-Since $c-_page_cache_not_modified( $data ); -} + +# Toby: Unmark page as being in progress: +$c-_page_cache_set_built; +# /Toby +} +# Toby: and remove the lockfile: +$c-_page_cache_remove_file; +# /Toby return $c-NEXT::finalize(@_); } @@ -306,6 +328,66 @@ return $key; } +# Toby +# This routine needs to check if this key is locked and currently building. +# Wait for it to complete - but timeout after a while, to avoid getting stuck? +sub _page_cache_check_if_building { +my $c = shift; +my $key = shift; +my $crckey = md5_hex($key); + +$c-log-debug(I need to check if $crckey is in-flight already.); +my $fh = _get_lock_file($crckey); +$c-_page_cache_lock_file($fh); +my $ret = flock($fh, LOCK_SH | LOCK_NB); + +if ($ret) { # We got the lock, so it isn't being built.. +flock($fh, LOCK_UN); +return; +} +# Need to do a select(..., $TIMEOUT) until it does complete. +$c-log-debug(Waiting for lock to clear, so we can continue..); +flock($fh, LOCK_SH); +flock($fh, LOCK_UN); +} + +# This routine sets a flag that says this page is currently in build. +sub _page_cache_set_is_building { +my $c = shift; +#my $key = $c-_get_page_cache_key; +#my $crckey = md5_hex($key); +#$c-log-debug(I want to set key: $crckey as in-flight.); +$c-log-debug(Marking this page as in-progress..); +my $fh = $c-_page_cache_lock_file; +flock($fh, LOCK_EX); +} + +# This is the converse of the above - it's complete. +sub _page_cache_set_built { +my $c = shift; +#my $key = $c-_get_page_cache_key; +#my $crckey = md5_hex($key); +#$c-log-debug(I want to set key: $crckey as completed.); +$c-log-debug(Marking cached page as completed building.); +my $fh = $c-_page_cache_lock_file; +flock($fh, LOCK_UN); +} + +sub _get_lock_file { +my $filename = '/dev/shm/.lock.ymogen.' . $_[0]; +my $fh = IO::File-new($filename, 'w+'); +die(Could not open lock file: $filename: $!) unless $fh; +} + +sub _page_cache_remove_file { +my $c = shift; +$c-log-debug(Removing page cache lockfile.); +my $fh = $c-_page_cache_lock_file; +# unlink($c-_page_cache_lock_filename); +$fh-close; +} + + 1; __END__ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: