From simon@simon-cozens.org Mon Mar 1 15:39:04 2004 From: simon@simon-cozens.org (Simon Cozens) Date: Mon, 1 Mar 2004 15:39:04 +0000 Subject: [Maypole] Re: Non-insignificant add/update issues In-Reply-To: <20040301153053.GA6346@panix.com> References: <20040301153053.GA6346@panix.com> Message-ID: <20040301153904.GA20585@alibi.simon-cozens.org> (Maybe we should be using the list, for Maypole discussions, to archive this sort of thing for posterity.) Jesse Sheidlower: > I renamed my "slang_user" table to "user" to avoid this problem for now. Well, you shouldn't need to, but I think we need to avoid or redefine "moniker" so that it uses the same rules as CDBI::Loader. > When I try to add a new anything (not just a user), Maypole dies > with a "Can't use an undefined value as an ARRAY reference at... > CDBI.pm line 38", this being the line in do_edit that goes > my ($obj) = @{$r->objects}; It doesn't go like that in CVS. :) > I'm not clear why this would show up empty. This happens because when you create a new entry the URL will be /foo/do_edit/, the args slot will be empty, and so "->objects" will also be empty. The latest version in CVS uses a belt-and-braces approach to ensure that ->objects is always at least an array reference, and that CDBI.pm does not unconditionally dereference it. I always wonder whether these things should return a proper list rather than a reference anyway. > I'm also getting weirdness when I try to edit an entry. Simply, > the entry does not update. I've set up untaint_columns and such, > and when I do an update, the "warn "Updating an object ($obj)"" > line of do_edit [which should, I expect, ultimately be pulled, > as it's debugging code] It should, yes, but not until we've finished debugging things like this. :) > shows that the correct values are being > set for the object. However, the object does not update, and > there are no errors shown. I've seen this when the untaint columns aren't properly specified, but I'm not sure what to do if they are. Can you check that whatever is specifying the untaint_columns is actually being called? > Is there some commit that needs to be performed, or something that > needs to be set? I'll send any code or error messages that would be > helpful. There shouldn't be a need for a commit, since it all works for me. -- Be not anxious about what you have, but about what you are. -- Pope St. Gregory I From mdi@iveyandbrown.com Mon Mar 1 16:47:40 2004 From: mdi@iveyandbrown.com (Michael D. Ivey) Date: Mon, 1 Mar 2004 10:47:40 -0600 Subject: [Maypole] Using maypole with existing CDBI business objects Message-ID: <20040301164740.GA14614@d2eb.gweezlebur.com> I have a set of Class::DBI business objects, and haven't written the web portion yet. I'd like to use Maypole. Is there a simple way to build the Model class based on existing class heirarchy? Thanks in advance. - Michael -- Michael D. Ivey, Senior Partner | mdi@iveyandbrown.com Ivey & Brown, Inc. | http://www.iveyandbrown.com Process and Technology Consulting | (866) 235-7764 From simon@simon-cozens.org Mon Mar 1 16:53:46 2004 From: simon@simon-cozens.org (Simon Cozens) Date: Mon, 1 Mar 2004 16:53:46 +0000 Subject: [Maypole] Using maypole with existing CDBI business objects In-Reply-To: <20040301164740.GA14614@d2eb.gweezlebur.com> References: <20040301164740.GA14614@d2eb.gweezlebur.com> Message-ID: <20040301165346.GA24785@alibi.simon-cozens.org> Michael D. Ivey: > I have a set of Class::DBI business objects, and haven't written the web > portion yet. I'd like to use Maypole. Is there a simple way to build > the Model class based on existing class heirarchy? You don't need to build your own Model class. It Just Works. See the BeerDB example (http://maypole.simon-cozens.org/doc/beerdb.html) Maypole: if you're writing code, YOU'RE DOING SOMETHING WRONG. -- There's no cinnamon and no lemon or orange involved. If there were, it was a heretic who mixed it up and the mixer should be impaled on a stake and buggered by the Shrike for two hours, then taken down and forced to rub the wounds with the mix until death sets in. - Ingvar Mattsson *cares* about cocktails. From jester@panix.com Mon Mar 1 17:00:52 2004 From: jester@panix.com (Jesse Sheidlower) Date: Mon, 1 Mar 2004 12:00:52 -0500 Subject: [Maypole] Re: Non-insignificant add/update issues In-Reply-To: <20040301153904.GA20585@alibi.simon-cozens.org> References: <20040301153053.GA6346@panix.com> <20040301153904.GA20585@alibi.simon-cozens.org> Message-ID: <20040301170052.GB19898@panix.com> On Mon, Mar 01, 2004 at 03:39:04PM +0000, Simon Cozens wrote: > Jesse Sheidlower wrote: > (Maybe we should be using the list, for Maypole discussions, to archive > this sort of thing for posterity.) (Makes sense.) > Well, you shouldn't need to, but I think we need to avoid or redefine > "moniker" so that it uses the same rules as CDBI::Loader. 'Twould be a good idea. > > When I try to add a new anything (not just a user), Maypole dies > > with a "Can't use an undefined value as an ARRAY reference at... > > CDBI.pm line 38", this being the line in do_edit that goes > > my ($obj) = @{$r->objects}; > > It doesn't go like that in CVS. :) You're right. Upgrading to the CVS version has fixed this problem. Thanks. > > I'm also getting weirdness when I try to edit an entry. Simply, > > the entry does not update. I've set up untaint_columns and such, > > and when I do an update, the "warn "Updating an object ($obj)"" > > line of do_edit [which should, I expect, ultimately be pulled, > > as it's debugging code] [...] > > shows that the correct values are being > > set for the object. However, the object does not update, and > > there are no errors shown. > > I've seen this when the untaint columns aren't properly specified, > but I'm not sure what to do if they are. Can you check that whatever > is specifying the untaint_columns is actually being called? I'll have to play around further. It _is_ being called; I know because I tried a test where I entered invalid values that should have triggered CGI::Untaint errors, and I managed to create some kind of endless loop that hung Apache entirely and I had to restart it :-/ Jesse Sheidlower From jester@panix.com Tue Mar 2 03:57:08 2004 From: jester@panix.com (Jesse Sheidlower) Date: Mon, 1 Mar 2004 22:57:08 -0500 Subject: [Maypole] Accessing $dbh from within Maypole? Message-ID: <20040302035708.GA5680@panix.com> If I need to access the $dbh directly from within Maypole, where do I find it? (Assuming an Apache::MVC base, of course.) I'm wanting to set up my session args for authentication, and have this: --- package FooDB; use base qw(Apache::MVC Maypole::Authentication::UserSessionCookie); FooDB->setup("dbi:mysql:foo","user","password" ); #... FooDB->config->{auth}{session_class} = "Apache::Session::Flex"; FooDB->config->{auth}{session_args} = { Store => 'MySQL', Lock => 'Null', Generate => 'MD5', Serialize => 'Storable', Handle => $dbh, # <<<< what here? LockHandle => $dbh # <<<< likewise }; #... --- Thanks. Jesse Sheidlower From dave@sialia.com Tue Mar 2 05:52:41 2004 From: dave@sialia.com (Dave Ranney) Date: Mon, 1 Mar 2004 21:52:41 -0800 Subject: [Maypole] Accessing $dbh from within Maypole? In-Reply-To: <20040302035708.GA5680@panix.com> References: <20040302035708.GA5680@panix.com> Message-ID: Jesse, Here's one way to find it: $dbh = FooDB->config->{classes}->[0]->db_Main(); Obviously, after you've called setup, any of your table-based model classes will have access to that method (but *not* your model base class). So you could simplify that to just FooDB::Tablename->db_Main(). But there's probably a more straightforward way. Anyone? -Dave On Mar 1, 2004, at 7:57 PM, Jesse Sheidlower wrote: > If I need to access the $dbh directly from within Maypole, where > do I find it? (Assuming an Apache::MVC base, of course.) > > Handle => $dbh, # <<<< what here? > LockHandle => $dbh # <<<< likewise > }; > #... ------ Dave Ranney Ladera Ranch, Orange County, CA dave@sialia.com CA Birding Lists Digest: http://www.sialia.com/s/calists.pl From simon@simon-cozens.org Tue Mar 2 10:10:13 2004 From: simon@simon-cozens.org (Simon Cozens) Date: Tue, 2 Mar 2004 10:10:13 +0000 Subject: [Maypole] Accessing $dbh from within Maypole? In-Reply-To: References: <20040302035708.GA5680@panix.com> Message-ID: <20040302101013.GB30235@alibi.simon-cozens.org> Dave Ranney: > Here's one way to find it: > $dbh = FooDB->config->{classes}->[0]->db_Main(); I sort of dislike that because it's a bit too familiar with the internal structures. > > Handle => $dbh, # <<<< what here? > > LockHandle => $dbh # <<<< likewise This looks like an authentication thing, so my initial thought of $r->model_class->db_Main won't do it. I'd go for Foo::User->db_Main as Dave suggests. -- Sucks really Forth. Ugh. From jester@panix.com Tue Mar 2 14:56:58 2004 From: jester@panix.com (Jesse Sheidlower) Date: Tue, 2 Mar 2004 09:56:58 -0500 Subject: [Maypole] Accessing $dbh from within Maypole? In-Reply-To: References: <20040302035708.GA5680@panix.com> Message-ID: <20040302145658.GA29892@panix.com> On Mon, Mar 01, 2004 at 09:52:41PM -0800, Dave Ranney wrote: > Jesse, > > Here's one way to find it: > > $dbh = FooDB->config->{classes}->[0]->db_Main(); > > Obviously, after you've called setup, any of your table-based model > classes will have access to that method (but *not* your model base > class). So you could simplify that to just FooDB::Tablename->db_Main(). Yup, this works perfectly. Thanks! I've posted this to the wiki, too. Jesse Sheidlower From simon@simon-cozens.org Tue Mar 2 18:27:33 2004 From: simon@simon-cozens.org (Simon Cozens) Date: Tue, 2 Mar 2004 18:27:33 +0000 Subject: [Maypole] Maypole comparisons/competitors Message-ID: <20040302182733.GA17623@alibi.simon-cozens.org> Could someone less biased and more knowledgable have a play with http://wiki.simon-cozens.org/index.cgi?MaypoleCompetitors for me, please? Thanks. -- >but I'm one guy working weekends - what the hell is MS's excuse? "We don't care, we don't have to, we're the phone company." - Ben Jemmet, Paul Tomblin. From jester@panix.com Wed Mar 3 04:28:11 2004 From: jester@panix.com (Jesse Sheidlower) Date: Tue, 2 Mar 2004 23:28:11 -0500 Subject: [Maypole] Re: Non-insignificant add/update issues In-Reply-To: <20040301170052.GB19898@panix.com> References: <20040301153053.GA6346@panix.com> <20040301153904.GA20585@alibi.simon-cozens.org> <20040301170052.GB19898@panix.com> Message-ID: <20040303042810.GA6039@panix.com> On Mon, Mar 01, 2004 at 12:00:52PM -0500, Jesse Sheidlower wrote: > On Mon, Mar 01, 2004 at 03:39:04PM +0000, Simon Cozens wrote: > > Jesse Sheidlower wrote: > > > > I'm also getting weirdness when I try to edit an entry. Simply, > > > the entry does not update. I've set up untaint_columns and such, > > > and when I do an update, the "warn "Updating an object ($obj)"" > > > line of do_edit [which should, I expect, ultimately be pulled, > > > as it's debugging code] > [...] > > > shows that the correct values are being > > > set for the object. However, the object does not update, and > > > there are no errors shown. > > > > I've seen this when the untaint columns aren't properly specified, > > but I'm not sure what to do if they are. Can you check that whatever > > is specifying the untaint_columns is actually being called? > > I'll have to play around further. It _is_ being called; I know > because I tried a test where I entered invalid values that > should have triggered CGI::Untaint errors, and I managed to > create some kind of endless loop that hung Apache entirely > and I had to restart it :-/ I have gone back to this, and realized that in fact my untaint_columns were _not_ properly specified. Indeed, they were not specified at all, which is an extreme case of improper specification. I had set them up for one class but not the other. Everything is working fine now, to my great delight. Jesse From dave@sialia.com Wed Mar 3 07:24:42 2004 From: dave@sialia.com (Dave Ranney) Date: Tue, 2 Mar 2004 23:24:42 -0800 Subject: [Maypole] Maypole comparisons/competitors In-Reply-To: <20040302182733.GA17623@alibi.simon-cozens.org> References: <20040302182733.GA17623@alibi.simon-cozens.org> Message-ID: Simon, From the Wiki: " CGI::Application Not a competitor, a collaborator. I have no problems envisioning a CGI::Application::Maypole, and indeed I'd like to see one. " I'd very much like to have a CGI-based driver for Maypole, to sit alongside Apache::MVC. In fact, I started to investigate what it would take to put one together, but got stopped cold by Maypole.pm's reliance on Apache::Constants. That module just won't play well outside of mod_perl (right? Or am I missing something?). I'm pretty sure that a CGI-based subclass of Maypole would require that Maypole be decoupled from Apache::Constants and the mod_perl paradigm in general. Looking at the code in Maypole.pm, I see that the various constants are really only used as result codes from various subroutines (is_applicable(), authenticate()). handler() also returns one of the Apache constants, but only because that is what the default view class (Maypole::View::TT) returns (and of course under mod_perl, handler() *must* return a valid result code). handler() could just as easily return any other value (i.e. whatever the current View class returns). Once Apache::Constants is out of the way, it should be a simple matter to subclass Maypole (CGI::MVC?), overriding get_request() and parse_location(). Next step would be to create a new View class that understands CGI objects rather than Apache::Request objects. Shouldn't be too hard. I'm pretty sure that at that point, you'd be able to take BeerDB.pm, change it to be a subclass of "CGI::MVC" rather than Apache::MVC, and then simply write your CGI script like this: #!/usr/bin/perl use BeerDB; BeerDB->handler(); exit; So, am I off base? Is it feasible to remove Maypole's reliance on mod_perl code? Thanks, -Dave From jester@panix.com Wed Mar 3 20:16:58 2004 From: jester@panix.com (Jesse Sheidlower) Date: Wed, 3 Mar 2004 15:16:58 -0500 Subject: [Maypole] Using secure server in particular conditions? Message-ID: <20040303201658.GA20882@panix.com> I assume there's an easy way to do this using some mod_perl knowledge that I don't possess. I'd like to be able to handle particular requests using SSL. How do I remap the request so this can happen? In a previous CGI-based application, I handled it at the server level by having RedirectMatch ^(.*login\.cgi) https://www.mysite.com$1 And then any links from my login page would be specified with http:// . Of course this only works if you're only doing the login page, and it happens to have a name ending in "login.cgi". How would I do it in Maypole, if, for example, I wanted any request to a "login" page, or anything at all using the "user" table, to be wrapped in SSL, but everything else to be normal? Thanks. Jesse Sheidlower From simon@simon-cozens.org Thu Mar 4 17:53:05 2004 From: simon@simon-cozens.org (Simon Cozens) Date: Thu, 4 Mar 2004 17:53:05 +0000 Subject: CGI::Maypole, etc. Re: [Maypole] Maypole comparisons/competitors In-Reply-To: References: <20040302182733.GA17623@alibi.simon-cozens.org> Message-ID: <20040304175305.GA5724@alibi.simon-cozens.org> Dave Ranney: > I'd very much like to have a CGI-based driver for Maypole, to sit > alongside Apache::MVC. In fact, I started to investigate what it would > take to put one together, but got stopped cold by Maypole.pm's reliance > on Apache::Constants. Well, I took an axe to this today, and Maypole itself is now clear of any dependence on Apache::Constants and the ->{ar} slot. Grab the changes from CVS if you like. This should make writing a CGI::Maypole much, much simpler. It should help with Apache2::MVC too, although that may just be CGI::Maypole in disguise. I'm not sure. I'm currently trying to work out what's the best way to handle form upload data, since CGI.pm and Apache::Request handle it in wildly different ways. Maybe I should abstract that out into the request object in the same way that I've abstracted out POST and GET data. -- About the use of language: it is impossible to sharpen a pencil with a blunt ax. It is equally vain to try to do it with ten blunt axes instead. -- Edsger Dijkstra From dave@sialia.com Thu Mar 4 21:32:55 2004 From: dave@sialia.com (Dave Ranney) Date: Thu, 4 Mar 2004 13:32:55 -0800 Subject: [Maypole] Re: CGI::Maypole, etc. In-Reply-To: <20040304175305.GA5724@alibi.simon-cozens.org> References: <20040302182733.GA17623@alibi.simon-cozens.org> <20040304175305.GA5724@alibi.simon-cozens.org> Message-ID: <7FF3EF19-6E23-11D8-842F-0030653FF4FE@sialia.com> > Well, I took an axe to this today, and Maypole itself is now clear of > any > dependence on Apache::Constants and the ->{ar} slot. Grab the changes > from CVS > if you like. Excellent! I'll grab the latest from CVS and have a crack at it tonight. Thanks Simon! -Dave ------ Dave Ranney Ladera Ranch, Orange County, CA dave@sialia.com CA Birding Lists Digest: http://www.sialia.com/s/calists.pl From dave@sialia.com Thu Mar 4 21:42:44 2004 From: dave@sialia.com (Dave Ranney) Date: Thu, 4 Mar 2004 13:42:44 -0800 Subject: [Maypole] Re: CGI::Maypole, etc. In-Reply-To: <7FF3EF19-6E23-11D8-842F-0030653FF4FE@sialia.com> References: <20040302182733.GA17623@alibi.simon-cozens.org> <20040304175305.GA5724@alibi.simon-cozens.org> <7FF3EF19-6E23-11D8-842F-0030653FF4FE@sialia.com> Message-ID: Er, though, I don't see any recent changes in CVS. Am I looking in the right place? http://cvs.simon-cozens.org/viewcvs.cgi/Apache-MVC/ -Dave On Mar 4, 2004, at 1:32 PM, Dave Ranney wrote: >> Well, I took an axe to this today, and Maypole itself is now clear of >> any >> dependence on Apache::Constants and the ->{ar} slot. Grab the changes >> from CVS >> if you like. > > Excellent! I'll grab the latest from CVS and have a crack at it > tonight. Thanks Simon! > > -Dave ------ Dave Ranney Ladera Ranch, Orange County, CA dave@sialia.com CA Birding Lists Digest: http://www.sialia.com/s/calists.pl From simon@simon-cozens.org Thu Mar 4 22:59:02 2004 From: simon@simon-cozens.org (Simon Cozens) Date: Thu, 4 Mar 2004 22:59:02 +0000 Subject: [Maypole] Re: CGI::Maypole, etc. In-Reply-To: References: <20040302182733.GA17623@alibi.simon-cozens.org> <20040304175305.GA5724@alibi.simon-cozens.org> <7FF3EF19-6E23-11D8-842F-0030653FF4FE@sialia.com> Message-ID: <20040304225902.GA17282@alibi.simon-cozens.org> Dave Ranney: > Er, though, I don't see any recent changes in CVS. Am I looking in the > right place? > > http://cvs.simon-cozens.org/viewcvs.cgi/Apache-MVC/ D'oh. I installed it locally to check it worked OK, then forgot to do the checkin. It's there now. -- There seems no plan because it is all plan. -- C.S. Lewis From moseley@hank.org Fri Mar 5 00:46:01 2004 From: moseley@hank.org (Bill Moseley) Date: Thu, 4 Mar 2004 16:46:01 -0800 Subject: [Maypole] Postgres users? Message-ID: <20040305004601.GA11696@hank.org> I assume everyone here saw my post on the CDBI list about Class::DBI::Loader. Anyone using Postgres (7.4.1) with Maypole? Or anyone familiar enough with Posgresql to help debug? I have a number of questions about Maypole, but would like to get my test application running first -- and I do want to test with Postgres. Thanks, -- Bill Moseley moseley@hank.org From dave@sialia.com Fri Mar 5 09:40:52 2004 From: dave@sialia.com (Dave Ranney) Date: Fri, 5 Mar 2004 01:40:52 -0800 Subject: [Maypole] CGI::Maypole In-Reply-To: <20040304225902.GA17282@alibi.simon-cozens.org> References: <20040302182733.GA17623@alibi.simon-cozens.org> <20040304175305.GA5724@alibi.simon-cozens.org> <7FF3EF19-6E23-11D8-842F-0030653FF4FE@sialia.com> <20040304225902.GA17282@alibi.simon-cozens.org> Message-ID: <316891F1-6E89-11D8-842F-0030653FF4FE@sialia.com> All, Here's a first draft of a CGI::Maypole. After Simon's latest changes to Maypole.pm, there were only a few minor modifications to Apache::MVC necessary to create this. Note that it will only work with the latest code from CVS. To use it, you'd just create a simple CGI script, something like this: ## file: beer.cgi #!/usr/bin/perl -w use strict; use BeerDB; BeerDB->run(); The BeerDB.pm example module that's included with the Maypole distribution requires only a couple of tweaks to work under CGI::Maypole: subclass from CGI::Maypole instead of Apache::MVC (obviously), and change BeerDB->config->{uri_base} to something that makes sense, e.g. "http://localhost/cgi-bin/beer.cgi/" The run() method is intended to be a wrapper around handler() for trapping status codes and errors. I envision trapping the common status codes in run() and printing appropriate headers. However, at this stage, there is still much work to be done to solidify Maypole's error handling before run() will really be useful for anything. So for now, it just calls handler(). Note also that the default view class, Maypole::View::TT, still relies on Apache::Constants, so any condition that results in a "Not Found" being returned from that class will likely result in an error. It is a simple matter though to create a custom view class that works better with CGI::Maypole. I haven't tested it yet under Apache::Registry, but will soon. Comments appreciated! -Dave ############# Code below ############## package CGI::Maypole; use base 'Maypole'; use CGI::Simple; use strict; use warnings; our $VERSION = "0.1"; sub run { my $self = shift; return $self->handler(); } sub get_request { shift->{cgi} = CGI::Simple->new(); } sub parse_location { my $self = shift; $self->{path} = $self->{cgi}->url(-absolute=>1, -path_info=>1); my $loc = $self->{cgi}->url(-absolute=>1); no warnings 'uninitialized'; $self->{path} =~ s/^($loc)?\///; $self->{path} ||= "frontpage"; my @pi = split /\//, $self->{path}; shift @pi while @pi and !$pi[0]; $self->{table} = shift @pi; $self->{action} = shift @pi; $self->{args} = \@pi; $self->{params} = { $self->{cgi}->Vars }; $self->{query} = { $self->{cgi}->Vars }; } sub send_output { my $r = shift; print $r->{cgi}->header(-type => $r->{content_type}, -content_length => length $r->{output}, ); print $r->{output}; } sub get_template_root { my $r = shift; $r->{cgi}->document_root . "/". $r->{cgi}->url(-relative=>1); } 1; =head1 NAME CGI::Maypole - CGI-based front-end to Maypole =head1 SYNOPSIS package BeerDB; use base 'CGI::Maypole; BeerDB->setup("dbi:mysql:beerdb"); BeerDB->config->{uri_base} = "http://your.site/cgi-bin/beer.cgi/"; BeerDB->config->{display_tables} = [qw[beer brewery pub style]]; # Now set up your database: # has-a relationships # untaint columns 1; ## example beer.cgi: #!/usr/bin/perl -w use strict; use BeerDB; BeerDB->run(); ########## End Code ########### ------ Dave Ranney Ladera Ranch, Orange County, CA dave@sialia.com CA Birding Lists Digest: http://www.sialia.com/s/calists.pl From jester@panix.com Fri Mar 5 14:31:13 2004 From: jester@panix.com (Jesse Sheidlower) Date: Fri, 5 Mar 2004 09:31:13 -0500 Subject: [Maypole] CGI::Maypole In-Reply-To: <316891F1-6E89-11D8-842F-0030653FF4FE@sialia.com> References: <20040302182733.GA17623@alibi.simon-cozens.org> <20040304175305.GA5724@alibi.simon-cozens.org> <7FF3EF19-6E23-11D8-842F-0030653FF4FE@sialia.com> <20040304225902.GA17282@alibi.simon-cozens.org> <316891F1-6E89-11D8-842F-0030653FF4FE@sialia.com> Message-ID: <20040305143113.GA13158@panix.com> On Fri, Mar 05, 2004 at 01:40:52AM -0800, Dave Ranney wrote: > All, > > Here's a first draft of a CGI::Maypole. After Simon's latest changes to > Maypole.pm, there were only a few minor modifications to Apache::MVC > necessary to create this. Note that it will only work with the latest > code from CVS. This looks great. Thanks for the work, Dave. Jesse Sheidlower From edrouant@charter.net Sat Mar 6 15:32:20 2004 From: edrouant@charter.net (Eric Drouant-ADT) Date: Sat, 6 Mar 2004 09:32:20 -0600 Subject: [Maypole] ADT Security Service- The best in the Business Message-ID: This is a multi-part message in MIME format. ------_=_NextPart_000_000094A4.025B2562 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by mxsf28.cluster1.charter.net id i26FWsUd024303

ADT SECURITY

Eric Drouant

edrouant@charter.net

985-788-1621

 

Hello,

 

The month of March is the time to take advantag= e of ADT=92s special offers on security systems. Don=92t put your family = or business at risk with a cheap giveaway security system. At ADT we inst= all only top quality equipment and provide the most up to date monitoring= in the industry.

 

We feature: intrusion detection, video surveillance systems, anti-the= ft sytems.

&nb= sp;

Call or e= mail today to set up an appointment to discuss your security concerns.

edrouant@charter.net

985-788-1621

 

------_=_NextPart_000_000094A4.025B2562-- From mdi@iveyandbrown.com Sat Mar 6 21:44:09 2004 From: mdi@iveyandbrown.com (Michael D. Ivey) Date: Sat, 6 Mar 2004 15:44:09 -0600 Subject: [Maypole] Trouble with beerdb Message-ID: <20040306214409.GA2052@d2eb.gweezlebur.com> I'm having pretty consistent trouble getting BeerDB to work. After following the examples, I get the following error in apache/error.log: [Fri Mar 5 22:43:03 2004] [error] Can't locate object method "set_db" via package "BeerDB::Beer" at /home/ivey/perl/share/perl/5.8.3/Class/DBI/Loader/mysql.pm line 23. Compilation failed in require at (eval 14) line 3. [Fri Mar 5 22:43:03 2004] [error] Can't use an undefined value as an ARRAY reference at /home/ivey/perl/share/perl/5.8.3/Maypole.pm line 41. I get the same error with SQLite. Any clues? I can send along more details if it's helpful. TIA -- Michael D. Ivey, Senior Partner | mdi@iveyandbrown.com Ivey & Brown, Inc. | http://www.iveyandbrown.com Process and Technology Consulting | (866) 235-7764 From mdi@iveyandbrown.com Sat Mar 6 22:11:50 2004 From: mdi@iveyandbrown.com (Michael D. Ivey) Date: Sat, 6 Mar 2004 16:11:50 -0600 Subject: [Maypole] Re: Trouble with beerdb In-Reply-To: <20040306214409.GA2052@d2eb.gweezlebur.com> References: <20040306214409.GA2052@d2eb.gweezlebur.com> Message-ID: <20040306221150.GA2204@d2eb.gweezlebur.com> On Sat, Mar 06, 2004 at 03:44:09PM -0600, Michael D. Ivey wrote: > I'm having pretty consistent trouble getting BeerDB to work. > After following the examples, I get the following error in > apache/error.log: Now I find the InstallationIssues page on Wiki. I swear that didn't used to be there. Nevermind. -- Michael D. Ivey, Senior Partner | mdi@iveyandbrown.com Ivey & Brown, Inc. | http://www.iveyandbrown.com Process and Technology Consulting | (866) 235-7764 From jester@panix.com Sat Mar 6 22:18:12 2004 From: jester@panix.com (Jesse Sheidlower) Date: Sat, 6 Mar 2004 17:18:12 -0500 Subject: [Maypole] Trouble with beerdb In-Reply-To: <20040306214409.GA2052@d2eb.gweezlebur.com> References: <20040306214409.GA2052@d2eb.gweezlebur.com> Message-ID: <20040306221811.GA17113@panix.com> On Sat, Mar 06, 2004 at 03:44:09PM -0600, Michael D. Ivey wrote: > I'm having pretty consistent trouble getting BeerDB to work. > After following the examples, I get the following error in > apache/error.log: > > [Fri Mar 5 22:43:03 2004] [error] Can't locate object method "set_db" via > package "BeerDB::Beer" at > /home/ivey/perl/share/perl/5.8.3/Class/DBI/Loader/mysql.pm line 23. > Compilation failed in require at (eval 14) line 3. > [Fri Mar 5 22:43:03 2004] [error] Can't use an undefined value as an ARRAY > reference at /home/ivey/perl/share/perl/5.8.3/Maypole.pm line 41. > > I get the same error with SQLite. Do you have Class::DBI::mysql (or ::SQLite) installed? That sounds like it's the cause of this. Jesse Sheidlower From jester@panix.com Sat Mar 6 22:33:22 2004 From: jester@panix.com (Jesse Sheidlower) Date: Sat, 6 Mar 2004 17:33:22 -0500 Subject: [Maypole] Re: Trouble with beerdb In-Reply-To: <20040306221150.GA2204@d2eb.gweezlebur.com> References: <20040306214409.GA2052@d2eb.gweezlebur.com> <20040306221150.GA2204@d2eb.gweezlebur.com> Message-ID: <20040306223322.GA22167@panix.com> On Sat, Mar 06, 2004 at 04:11:50PM -0600, Michael D. Ivey wrote: > On Sat, Mar 06, 2004 at 03:44:09PM -0600, Michael D. Ivey wrote: > > I'm having pretty consistent trouble getting BeerDB to work. > > After following the examples, I get the following error in > > apache/error.log: > > Now I find the InstallationIssues page on Wiki. I swear that didn't > used to be there. Whoops, slippage. I'll rejigger the wiki pages a bit--this isn't really a Cookbook thing, it shouldn't be part of that. Jesse Sheidlower From simon@simon-cozens.org Mon Mar 8 11:46:18 2004 From: simon@simon-cozens.org (Simon Cozens) Date: Mon, 8 Mar 2004 11:46:18 +0000 Subject: [Maypole] Where are we up to? Message-ID: <20040308114618.GA29160@alibi.simon-cozens.org> I'm going to try and put a couple of days into Maypole and Flox hacking this week, and hopefully get a new Maypole release out, financial circumstances permitting. What needs to be done? I think I need to sit down and have a blitz on writing some decent documentation, test out CGI::Maypole, and try to get uploading working. Is there anything else that people are having issues with? Jesse, where are you up to at the moment? -- COBOL is for morons. -- E.W. Dijkstra From jester@panix.com Mon Mar 8 15:45:31 2004 From: jester@panix.com (Jesse Sheidlower) Date: Mon, 8 Mar 2004 10:45:31 -0500 Subject: [Maypole] Where are we up to? In-Reply-To: <20040308114618.GA29160@alibi.simon-cozens.org> References: <20040308114618.GA29160@alibi.simon-cozens.org> Message-ID: <20040308154530.GA18844@panix.com> On Mon, Mar 08, 2004 at 11:46:18AM +0000, Simon Cozens wrote: > I'm going to try and put a couple of days into Maypole and Flox hacking this > week, and hopefully get a new Maypole release out, financial circumstances > permitting. Great! > What needs to be done? I think I need to sit down and have a blitz on writing > some decent documentation, test out CGI::Maypole, and try to get uploading > working. Is there anything else that people are having issues with? Jesse, > where are you up to at the moment? Well, as long as you're asking.... I'll repost here some things I sent personally last week, and add a few more things that I think could be useful. And always more doc stuff, which I find myself needing as I try to figure out what's happening when. * Flox features should be mentioned in the wiki cookbook, if not incorporated into the base app itself. There are neat things in there that one only discovers from reading the source. E-mail is an example--you should say somewhere how to send e-mail from a Maypole app. Every time you hack on Flox, you add something that would be good to have, or at least know about, for other Maypole uses. * Documentation for how to work with relationships would be nice, esp. for those of us with less experience in CDBI. For example, to take Kake's rough framework in no_code, suppose each book has_many review, and each review has_a review_author. To add a new review, you click on an "add review" link from a book. It would be helpful to see a short example showing (both templates and code) how the new review picks up the book's id, and how to generate a popup menu with the contents of the review_author table, and how this all gets added. (I realize that Maypole _does this already,_ but since it's magical, it would help to see how it works so that if one needed to modify it, one could write one's own routines that do similar things. And I assume it would only take about a paragraph to describe this.) * Uploads, as you mention. Some flexibility would be good, so that, for example, you could upload a picture with several different descriptive fields [perhaps one of them being drawn from a lookup table], that could be done. Or if the file is being uploaded into an image table, instead of into a column in the main table. That sort of thing. * Security. I mentioned this last week on the list. It's probably simple, but the basic requirement would be that particular pages could be handled over an SSL connection (say, the login page, and any access to the user table), and one should be able to do this as needed. * Searching. Perhaps some way of flexiblizing the search? Say, instead of having to rewrite the entire search routine, said routine could look for an assemble_search method which would process the params into something suitable for sticking into AbstractSearch. Then the search routine itself would do the same thing, so that the existence of assemble_search would override the built in search thing, but AbstractSearch would be the base in any case. And, if you wanted to write an especially complicated search, you could write the SQL directly and inline it, again without having to totally rewrite the search routine. (Or, docs showing how this could be done if necessary.) (I have a project that involves a number of non-small tables, and CDBI wouldn't be able to handle it its usual way, I need the raw SQL for speed.) * More flexibility for the default templates? The way things are set up now, the do_edit routine will always return you to a "view" template--if you don't have a "view" template (perhaps because you wanted to call it "displayfull", or "sicht" or "vue" or "vista"), you're stuck, unless you want to rewrite what should be a core routine. That'll do for a start, perhaps, esp. as I have to put aside my computer and hack out a bunch of definitions.... But I'll send some more thoughts to the list as I have them. Thanks for all your work on this! Best Jesse From publiustemp-maypole@yahoo.com Mon Mar 8 16:44:25 2004 From: publiustemp-maypole@yahoo.com (publiustemp-maypole@yahoo.com) Date: Mon, 8 Mar 2004 08:44:25 -0800 (PST) Subject: [Maypole] Installation Suggestion Message-ID: <20040308164425.13954.qmail@web60806.mail.yahoo.com> Hi All, Simon, thanks for putting together a rather nice project. I hope it takes off. One quick suggestion about the installation: Maypole installs BeerDB.pm but I think either it shouldn't or it should be more clear that it does. I tried to go through the BeerDB example and I didn't install my BeerDB.pm in the same path. Apache found the default BeerDB.pm before it found mine. I don't use MySQL, so I was struggling to figure out the mysql errors in my Apache logs. Cheers, Ovid ===== Silence is Evil http://users.easystreet.com/ovid/philosophy/indexdecency.htm Ovid http://www.perlmonks.org/index.pl?node_id=17000 Web Programming with Perl http://users.easystreet.com/ovid/cgi_course/ From simon@simon-cozens.org Mon Mar 8 17:40:30 2004 From: simon@simon-cozens.org (Simon Cozens) Date: Mon, 8 Mar 2004 17:40:30 +0000 Subject: [Maypole] Where are we up to? In-Reply-To: <20040308154530.GA18844@panix.com> References: <20040308114618.GA29160@alibi.simon-cozens.org> <20040308154530.GA18844@panix.com> Message-ID: <20040308174030.GA14600@alibi.simon-cozens.org> Jesse Sheidlower: > * Security. I mentioned this last week on the list. It's > probably simple, but the basic requirement would be that > particular pages could be handled over an SSL connection I have a feeling this is purely a mod_perl thing rather than requiring in any support in Maypole, but I'll try and work out how to do it anyway since it'll be a useful thing to implement in demonstration applications. As for the rest, I've put them on the MaypoleTodo page of the wiki. -- The Second Law of Thermodynamics: If you think things are in a mess now, just wait! From simon@simon-cozens.org Mon Mar 8 17:43:56 2004 From: simon@simon-cozens.org (Simon Cozens) Date: Mon, 8 Mar 2004 17:43:56 +0000 Subject: [Maypole] Installation Suggestion In-Reply-To: <20040308164425.13954.qmail@web60806.mail.yahoo.com> References: <20040308164425.13954.qmail@web60806.mail.yahoo.com> Message-ID: <20040308174356.GB14600@alibi.simon-cozens.org> publiustemp-maypole@yahoo.com: > Simon, thanks for putting together a rather nice project. I hope it > takes off. Thanks - and thanks for publicising it on use.perl and perlmonks. > One quick suggestion about the installation: Maypole installs > BeerDB.pm but I think either it shouldn't or it should be more clear > that it does. I think it probably shouldn't install it; I also think it should install the factory templates in a standard location. Unfortunately, I don't currently have the Makefile.PL juju to know how to do either of these off-hand. Patches welcome... -- You can't have everything... where would you put it? -- Steven Wright From publiustemp-maypole@yahoo.com Mon Mar 8 19:34:57 2004 From: publiustemp-maypole@yahoo.com (Ovid) Date: Mon, 8 Mar 2004 11:34:57 -0800 (PST) Subject: [Maypole] Installation Suggestion In-Reply-To: <20040308174356.GB14600@alibi.simon-cozens.org> Message-ID: <20040308193457.42855.qmail@web60804.mail.yahoo.com> --- Simon Cozens wrote: > Thanks - and thanks for publicising it on use.perl and perlmonks. No problem. I like the idea of a lightweight solution to this problem. > I think it probably shouldn't install it; I also think it should > install the > factory templates in a standard location. Unfortunately, I don't > currently > have the Makefile.PL juju to know how to do either of these off-hand. > Patches welcome... Barring me misunderstand something here, I think there are several solutions, all of which require more than a simple patch, none of which are terribly difficult. Solution 1: Remove BeerDB from the distribution. As far as I can see, you don't actually use BeerDB.pm anywhere, even in the tests. Am I mistaken? Solution 2: Move BeerDB out of the lib/ directory and into an examples/ or t/test_lib/ directory. By going that route, you can include BeerDB but not worry about it being installed. If you browse Class::Trait (http://search.cpan.org/src/STEVAN/Class-Trait-0.01/), you'll see an example of test modules that are included in the test directory. Cheers, Ovid ===== Silence is Evil http://users.easystreet.com/ovid/philosophy/indexdecency.htm Ovid http://www.perlmonks.org/index.pl?node_id=17000 Web Programming with Perl http://users.easystreet.com/ovid/cgi_course/ From moseley@hank.org Tue Mar 9 01:05:19 2004 From: moseley@hank.org (Bill Moseley) Date: Mon, 8 Mar 2004 17:05:19 -0800 Subject: [Maypole] Where are we up to? In-Reply-To: <20040308154530.GA18844@panix.com> References: <20040308114618.GA29160@alibi.simon-cozens.org> <20040308154530.GA18844@panix.com> Message-ID: <20040309010518.GB29904@hank.org> On Mon, Mar 08, 2004 at 11:46:18AM +0000, Simon Cozens wrote: > What needs to be done? I think I need to sit down and have a blitz on writing > some decent documentation, test out CGI::Maypole, and try to get uploading > working. Is there anything else that people are having issues with? Jesse, > where are you up to at the moment? Postgres? I seem to have fixed the CDBI::Loader::Pg and CDBI::Pg modules to work with 7.4.1 and now my classes are automatically created. I spent my time on that problem instead of groking the Maypole code otherwise I'd likely have some comments. But, I'm having a tough time getting my sample application to work correctly. I'm using 1.1 and using the templates shipped with Maypole. I'm not clear if that will work or not for simple testing with my tables. But, as it is, links are not working correctly and only some tables will display. Anyway, before investing more time, is there any chance that a Postgresql database will work with Maypole at this time? -- Bill Moseley moseley@hank.org From dave@sialia.com Tue Mar 9 01:37:21 2004 From: dave@sialia.com (Dave Ranney) Date: Mon, 8 Mar 2004 17:37:21 -0800 Subject: [Maypole] Where are we up to? In-Reply-To: <20040309010518.GB29904@hank.org> References: <20040308114618.GA29160@alibi.simon-cozens.org> <20040308154530.GA18844@panix.com> <20040309010518.GB29904@hank.org> Message-ID: <4F2A118B-716A-11D8-842F-0030653FF4FE@sialia.com> Bill, > Postgres? > > I seem to have fixed the CDBI::Loader::Pg and CDBI::Pg modules to work > with 7.4.1 and now my classes are automatically created. I spent my > time on that problem instead of groking the Maypole code otherwise I'd > likely have some comments. What was required to fix those modules? Are there patches available? > Anyway, before investing more time, is there any chance that a > Postgresql database will work with Maypole at this time? If your classes are being loaded successfully, you should be able to get Maypole working. What exactly is going wrong? Error messages? Post more info here and I'll give it a shot with Postgres. -Dave ------ Dave Ranney Ladera Ranch, Orange County, CA dave@sialia.com CA Birding Lists Digest: http://www.sialia.com/s/calists.pl From moseley@hank.org Tue Mar 9 01:55:29 2004 From: moseley@hank.org (Bill Moseley) Date: Mon, 8 Mar 2004 17:55:29 -0800 Subject: [Maypole] Where are we up to? In-Reply-To: <4F2A118B-716A-11D8-842F-0030653FF4FE@sialia.com> References: <20040308114618.GA29160@alibi.simon-cozens.org> <20040308154530.GA18844@panix.com> <20040309010518.GB29904@hank.org> <4F2A118B-716A-11D8-842F-0030653FF4FE@sialia.com> Message-ID: <20040309015529.GA30303@hank.org> On Mon, Mar 08, 2004 at 05:37:21PM -0800, Dave Ranney wrote: > Bill, > > >Postgres? > > > >I seem to have fixed the CDBI::Loader::Pg and CDBI::Pg modules to work > >with 7.4.1 and now my classes are automatically created. I spent my > >time on that problem instead of groking the Maypole code otherwise I'd > >likely have some comments. > > What was required to fix those modules? Are there patches available? They are hacks. I'm not familiar enough with the Postgres metadata to know for sure I didn't break things. But, there were two problems that I could see: First, DBI was returning *all* the tables, including all the meta data tables. So Loader::Pg was creating classes with odd names and not just for my tables. So what I did was filter on the "public.*" tables as you can see in the patch. The second thing was CDBI::Pg was expecting only single primary keys, and I have a link table that has two keys (another issue is how to use with Maypole) and CDBI::Pg was croaking on that. My "patch" is below. It would be great to see someone else look it over. > >Anyway, before investing more time, is there any chance that a > >Postgresql database will work with Maypole at this time? > > If your classes are being loaded successfully, you should be able to > get Maypole working. What exactly is going wrong? Error messages? Post > more info here and I'll give it a shot with Postgres. First let me just post my setup and see if I'm doing anything stupid, ok? ;) Then I can plug away. But are there not issues with building form elements with Postgresql? I was expecting to override the form generation with my own templates. (I like to use HTML::FillInForm for creating sticky forms.) But, without a working setup it's been hard to understand what I can and can't do. My test application is for registering students to classes. A class is defined as a specific workshop, given at a location, by a teacher, on some date. moseley@bumby:~/workshop$ cat Workshop.pm package Workshop; use base 'Apache::MVC'; __PACKAGE__->setup("dbi:Pg:dbname=workshop;host=bumby", "user", "pass" ); __PACKAGE__->config->{uri_base} = "http://bumby:2345/workshop/"; __PACKAGE__->config->{rows_per_page} = 10; __PACKAGE__->config->{display_tables} = [ qw/ workshop teacher location student class / ]; Workshop::Workshop->untaint_columns( printable => [ qw/ name description / ], ); Workshop::Teacher->untaint_columns( printable => [ qw/ name email / ], ); Workshop::Location->untaint_columns( printable => [ qw/ name address / ], ); Workshop::Student->untaint_columns( printable => [ qw/ name / ], integer => [ qw/ age / ], ); Workshop::Class->untaint_columns( date => [ 'date' ], integer => [ qw/ location workshop teacher / ], ); Workshop::Class->has_a( location => "Workshop::Location" ); Workshop::Class->has_a( workshop => "Workshop::Workshop" ); Workshop::Class->has_a( teacher => "Workshop::Teacher" ); Workshop::Registration->has_a( student => "Workshop::Student" ); Workshop::Registration->has_a( class => "Workshop::Class" ); Workshop::Workshop->has_many( classes => "Workshop::Class" ); 1; moseley@bumby:~/workshop$ cat httpd.conf Include /etc/apache-perl/modules.conf LogFormat "%h %l \"%u\" %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\" %P" combined ErrorLog /home/moseley/apache-perl/error_log TransferLog /home/moseley/apache-perl/access_log PidFile /home/moseley/apache-perl/httpd.pid User nobody Group users Listen *:2345 use lib '/home/moseley/workshop'; require Workshop; NameVirtualHost *:2345 DocumentRoot /home/moseley/workshop/public_html ServerName bumby SetHandler perl-script PerlHandler Workshop PerlSetVar StatusDumper On PerlSetVar StatusTerseSizeMainSummary On SetHandler perl-script PerlHandler Apache::Status --- /usr/share/perl5/Class/DBI/Loader/Pg.pm 2002-08-26 01:03:40.000000000 -0700 +++ Loader::Pg.pm 2004-03-08 16:51:46.000000000 -0800 @@ -15,6 +15,14 @@ my $self = shift; my $dbh = DBI->connect(@{$self->_datasource}) or _croak($DBI::errstr); foreach my $table($dbh->tables) { + + # Check for Pg 7.4.x for these + ## That's just the version I'm using, so no idea if pre 7.4 needed this + if ( $self->pg_version( $dbh ) >= 7.4 ) { + next unless $table =~ /public\.(.+)$/; + $table = $1; + } + my $class = $self->_table2class($table); no strict 'refs'; @{"$class\::ISA"} = qw(Class::DBI::Pg); @@ -25,6 +33,19 @@ $dbh->disconnect; } +sub pg_version { + my $class = shift; + my $dbh = shift; + my $sth = $dbh->prepare("SELECT version()"); + $sth->execute; + my($ver_str) = $sth->fetchrow_array; + $sth->finish; + my($ver) = $ver_str =~ m/^PostgreSQL ([\d\.]{3})/; + return $ver; +} + + + 1; __END__ moseley@bumby:~/workshop$ diff -u `perldoc -l Class::DBI::Pg` Pg.pm --- /usr/share/perl5/Class/DBI/Pg.pm 2003-09-10 00:59:40.000000000 -0700 +++ Pg.pm 2004-03-08 16:51:07.000000000 -0800 @@ -10,6 +10,7 @@ sub set_up_table { my($class, $table) = @_; + my $dbh = $class->db_Main; my $catalog = ""; if ($class->pg_version >= 7.3) { @@ -23,7 +24,7 @@ WHERE relname = ?) SQL $sth->execute($table); - my $prinum = $sth->fetchrow_array; + my %prinum = map { $_ => 1 } map { split /\s+/ } $sth->fetchrow_array; $sth->finish; # find all columns @@ -48,19 +49,19 @@ $sth->execute($table); my($nextval_str) = $sth->fetchrow_array; $sth->finish; - my($sequence) = $nextval_str =~ m/^nextval\('"?([^"']+)"?'::text\)/; + my($sequence) = $nextval_str =~ m/^nextval\('"?([^"']+)"?'::text\)/ + if $nextval_str; - my(@cols, $primary); + my(@cols, @primary); foreach my $col(@$columns) { # skip dropped column. next if $col->[0] =~ /^\.+pg\.dropped\.\d+\.+$/; push @cols, $col->[0]; - next unless $prinum && $col->[1] eq $prinum; - $primary = $col->[0]; + push @primary, $col->[0] if $prinum{ $col->[1] }; } - _croak("$table has no primary key") unless $primary; + _croak("$table has no primary key") unless @primary; $class->table($table); - $class->columns(Primary => $primary); + $class->columns(Primary => @primary ); $class->columns(All => @cols); $class->sequence($sequence) if $sequence; } -- Bill Moseley moseley@hank.org From dave@sialia.com Tue Mar 9 06:03:36 2004 From: dave@sialia.com (Dave Ranney) Date: Mon, 8 Mar 2004 22:03:36 -0800 Subject: [Maypole] Maypole::View::TT patch Message-ID: <80A6FC2B-718F-11D8-842F-0030653FF4FE@sialia.com> I realize that it's a bit early in the game for optimizations, but this one jumped out at me as obvious and easy to improve. Maypole::View::TT creates a new Template object for each request. This is expensive and unnecessary. The patch below gives TT.pm a registry to house singleton Template objects on a per-app basis. Only the INCLUDE_PATH is modified per request (and really only a portion of that needs to be dynamic -- should probably fix that part, too). My very informal benchmarks show a speed increase of almost 500% with the patch applied. If someone knows a cleaner way of dynamically modifying the INCLUDE_PATH, please share. The method in the patch has always just worked for me, but it sure is ugly! More changes I'd like to see for Maypole::View::TT : _ remove the dependency on Apache::Constants, so that CGI::Maypole can use the default view _ Fix the error method to return "Not Found" instead of "Declined" when a template doesn't exist _ provide a clean method for sending additional config parameters to the Template constructor -Dave ------ Dave Ranney Ladera Ranch, Orange County, CA dave@sialia.com CA Birding Lists Digest: http://www.sialia.com/s/calists.pl #################################### [root@dev Apache-MVC]# diff -u lib/Maypole/View/TT.pm /usr/local/lib/perl5/site_perl/5.8.3/Maypole/View/TT.pm --- lib/Maypole/View/TT.pm 2004-03-04 14:58:28.000000000 -0800 +++ /usr/local/lib/perl5/site_perl/5.8.3/Maypole/View/TT.pm 2004-03-08 21:44:54.000000000 -0800 @@ -11,14 +11,30 @@ sub _tt { my ($self, $r) = @_; - # This bit sucks. + my $root = $r->{config}{template_root} || $r->get_template_root; - Template->new({ INCLUDE_PATH => [ - $root, - ($r->model_class && File::Spec->catdir($root, $r->model_class->moniker)), - File::Spec->catdir($root, "custom"), - File::Spec->catdir($root, "factory") - ]}); + my $base_class = ref($r); + + ## TODO -- it's silly to recreate + ## the custom and factory paths with each request. + + my $include_path = [ $root, + ($r->model_class && File::Spec->catdir($root, + $r->model_class->moniker)), + File::Spec->catdir($root, "custom"), + File::Spec->catdir($root, "factory"), + ]; + + if (! $self->{__template_objects}{$base_class}) { + $self->{__template_objects}{$base_class} = + Template->new({ INCLUDE_PATH => $include_path}); + } + else { + $self->{__template_objects}{$base_class}->service->context-> + load_templates->[0]->include_path($include_path); + } + + return $self->{__template_objects}{$base_class}; } sub _args { From dave@sialia.com Tue Mar 9 06:11:50 2004 From: dave@sialia.com (Dave Ranney) Date: Mon, 8 Mar 2004 22:11:50 -0800 Subject: [Maypole] CGI::Maypole -- minor modification Message-ID: Here's a new version of CGI::Maypole, with one small change. I've removed the requirement of CGI::Simple as the CGI class. It'll still use CGI::Simple by default, but there's no reason why someone shouldn't be able to subclass and override get_request() to use CGI.pm or any other module. (This is obviously akin to CGI::Application.) -Dave ------ Dave Ranney Ladera Ranch, Orange County, CA dave@sialia.com CA Birding Lists Digest: http://www.sialia.com/s/calists.pl ############################################ package CGI::Maypole; use base 'Maypole'; use strict; use warnings; our $VERSION = "0.2"; sub run { my $self = shift; return $self->handler(); } sub get_request { require CGI::Simple; shift->{cgi} = CGI::Simple->new(); } sub parse_location { my $self = shift; $self->{path} = $self->{cgi}->url(-absolute=>1, -path_info=>1); my $loc = $self->{cgi}->url(-absolute=>1); no warnings 'uninitialized'; $self->{path} =~ s/^($loc)?\///; $self->{path} ||= "frontpage"; my @pi = split /\//, $self->{path}; shift @pi while @pi and !$pi[0]; $self->{table} = shift @pi; $self->{action} = shift @pi; $self->{args} = \@pi; $self->{params} = { $self->{cgi}->Vars }; $self->{query} = { $self->{cgi}->Vars }; } sub send_output { my $r = shift; print $r->{cgi}->header(-type => $r->{content_type}, -content_length => length $r->{output}, ); print $r->{output}; } sub get_template_root { my $r = shift; $r->{cgi}->document_root . "/". $r->{cgi}->url(-relative=>1); } 1; =head1 NAME CGI::Maypole - CGI-based front-end to Maypole =head1 SYNOPSIS package BeerDB; use base 'CGI::Maypole; BeerDB->setup("dbi:mysql:beerdb"); BeerDB->config->{uri_base} = "http://your.site/cgi-bin/beer.cgi/"; BeerDB->config->{display_tables} = [qw[beer brewery pub style]]; # Now set up your database: # has-a relationships # untaint columns 1; ## example beer.cgi: #!/usr/bin/perl -w use strict; use BeerDB; BeerDB->run(); From oliver.gorwits@computing-services.oxford.ac.uk Tue Mar 9 12:05:18 2004 From: oliver.gorwits@computing-services.oxford.ac.uk (Oliver Gorwits) Date: Tue, 9 Mar 2004 12:05:18 +0000 Subject: [Maypole] Where are we up to? In-Reply-To: <20040308114618.GA29160@alibi.simon-cozens.org> References: <20040308114618.GA29160@alibi.simon-cozens.org> Message-ID: <20040309120518.7cf7f691.oliver.gorwits@computing-services.oxford.ac.uk> Hi Simon, I've not dug around Apache::MVC etc. in detail, but well done on what looks to be a handy little framework! On Mon, 8 Mar 2004 11:46:18 +0000 Simon Cozens wrote: > What needs to be done? I think I need to sit down and have a blitz on > writing some decent documentation Might I suggest, as part of the documentation effort, a more complex example than the BeerDB application? Perhaps something that includes messing with visible columns, titles, aliases, Stringification, related_accessors, and so on. I think this would really help those without experience of CDBI, Apache:: or TT who are probably happy with BeerDB but don't know what else is possible, or how to go about achieving something they have in mind. > Is there anything else that people are having issues with? 'name' seems to be a magic column title; could this be made more obvious, or even better a facility to setup magic columns yourself? regards, oliver. -- Oliver Gorwits, Network Infrastructure Group Oxford University Computing Services From simon@simon-cozens.org Tue Mar 9 12:27:31 2004 From: simon@simon-cozens.org (Simon Cozens) Date: Tue, 9 Mar 2004 12:27:31 +0000 Subject: [Maypole] The plan for documentation In-Reply-To: <20040309120518.7cf7f691.oliver.gorwits@computing-services.oxford.ac.uk> References: <20040308114618.GA29160@alibi.simon-cozens.org> <20040309120518.7cf7f691.oliver.gorwits@computing-services.oxford.ac.uk> Message-ID: <20040309122731.GA29082@alibi.simon-cozens.org> Oliver Gorwits: > Might I suggest, as part of the documentation effort, a more complex > example than the BeerDB application? Perhaps something that includes > messing with visible columns, titles, aliases, Stringification, > related_accessors, and so on. Funny, I'm currently starting on the massive task of planning out and writing the Maypole manual. I'm slightly worried that I won't be able to get this done by September; I've applied for a TPF grant to be able to spend some time on it, but I haven't heard back from them yet. I'm preparing it in the form of a book, because I can write books, but it's unlikely that any publisher is going to take on a manual for an unproven and hardly deployed emerging technology. (Except perhaps for O'Reilly's new academic press series but they don't commission books, only print existing ones.) > I think this would really help those without experience of CDBI, > Apache:: or TT who are probably happy with BeerDB but don't know what > else is possible, or how to go about achieving something they have in > mind. Here's what I've written for the Overview document: The Maypole documentation is arranged over several files; this is a good one to start with. Once you've read this, you should probably look at L, the guide to what Maypole is and how the Maypole request works. It also describes how to set up a simple CRUD web application in Maypole. The next two chapters are quite thorough, and you might want to skip over them if you already know how L and the L