From rs@plusw.de Tue Mar 1 12:58:40 2005 From: rs@plusw.de (Rolf Schaufelberger) Date: Tue, 1 Mar 2005 13:58:40 +0100 Subject: [Maypole] invalid CODE In-Reply-To: <42245DA2.6080507@flacks.net> References: <200503011024.50061.rs@plusw.de> <42245DA2.6080507@flacks.net> Message-ID: <200503011358.40743.rs@plusw.de> Am Dienstag 01 M=E4rz 2005 13:18 schrieb Simon Flack: > Rolf Schaufelberger wrote: > > Hi, > > > > I want to use the Maypole (Class::DBI) Classes outside Maypole (I have > > some scripts, feeding my database) > > > > So, for Maypole I have my > > BeerDB.pm and some BeerDB/Pub.om, BeerDB/Beer.pm etc > > > > To use it outside Maypole I've setup a > > Beer/DBI.pm which just calls > > Class::DBI::Loader to create the classes. > > > > But now I get an compile error > > > > invalied CODE attribute: Exported at bla/bla/BeerDB/Users.pm > > > > (and BeerDB/Users I have: sub authenticate : Exported {..} ) > > > > adding "use attributes" changed nothing, reading the attributes man page > > doesn't really help me. What's wrong ? > > 'Exported' isn't a built in code attribute, and must be defined in your > BeerDB::* CDBI classes or in their @ISA inheritance tree. When you use > your Class::DBI classes in Maypole, the Exported attribute will be > defined for you. You're getting this error since you're trying to use > those classes outside Maypole without defining the attribute. Yes, that was probably the last thing I've understood when reading the man= =20 page.It would be much cleare if they just added an example, so one can=20 understand what they are talking about :-) > > Here are a few things you could try: > > 1. Move your Maypole actions into a different file, and keep your > BeerDB:: classes plain, vanilla CDBI. It sounds like you may have > already done this. If so, are you manually requiring BeerDB::Users and > do you need to if you're using it outside Maypole? > > 2. Define the Exported attribute in your CDBI classes. See > "Package-specific Attribute Handling" in perldoc attributes. Or here's a > quick example that will allow you to define subs with Exported attributes: > > sub MODIFY_CODE_ATTRIBUTES { > my ($class, $code, @attrs) =3D @_; > return grep $_ ne 'Exported', @attrs; > } > Well, this works! Or , more precice , it's a combination of 2. and 3.=20 I've set it up now like : =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D package BeerDB::DBI; use Class::DBI::Loader; my $l =3D C::D::L->new ( dsn=3D> .. namespace=3D>'BeerDB', additional_base_classes =3D> qw 'BeerDB::Dummy',); package BeerDB::Dummy; sub untaint_columns {}; sub MODIFY_CODE_ATTRIBUTES { my ($class, $code, @attrs) =3D @_; return grep $_ ne 'Exported', @attrs; } 1; =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D and my application calls: use BeerDB::DBI; use BeerDB::Users; =2E..=20 and can use all BeerDB::* classes umodified. Thanks. > 3. Tell Class::DBI::Loader to set up your classes with a base class that > defines the Exported attribute using the 'additional_base_classes' > option. E.g. inherit from Maypole::Model::CDBI > > 4. Use a mechanism other than attributes to mark actions that are > public. You can do this by defining an is_public method in your Maypole > model class. If you do this you'll have to do extra work to continue > using the default Maypole actions. > > HTH > > --simonflk =2D-=20 Mit freundlichen Gr=FCssen Rolf Schaufelberger =2D------------------------------------------------------------------ plusW Dipl. Ing. Rolf Schaufelberger Tel. 07183/ 30 54 54 Stuttgarter Str. 26 E-Mail: rs@plusw.de 73635 Rudersberg From chicks@chicks.net Tue Mar 1 21:33:15 2005 From: chicks@chicks.net (Christopher Hicks) Date: Tue, 1 Mar 2005 16:33:15 -0500 (EST) Subject: [Maypole] use URI in Plugin/Authentication/UserSessionCookie.pm Message-ID: Among other problems I had was that MPA:USC blew up because there was no use URI line before the "URI->new()" code in login_user. Sticking use URI in fixed this. -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) From sri@oook.de Tue Mar 1 22:06:49 2005 From: sri@oook.de (Sebastian Riedel) Date: Tue, 01 Mar 2005 23:06:49 +0100 Subject: [Maypole] [ANNOUNCE] Catalyst 4 Message-ID: <4224E779.609@oook.de> We've just released Catalyst version 4 to CPAN. file: $CPAN/authors/id/S/SR/SRI/Catalyst-4.01.tar.gz size: 22194 bytes md5: a8bc74eb60d2dc31a8001c93698e77dc Next to countless new features and bugfixes, the most noteworthy changes are helpers (small tools to generate code for you) and a new introduction manual. Thanks to the helpers starting a new application is now as easy as catalyst My::App this will create all directories and files needed for a running Catalyst application, which you can test with bin/server adding a view is equally simple bin/create view MyView TT or a CDBI model bin/create model MyModel CDBI dbi:SQLite:/tmp/my.db create not just creates classes for you, it also adds unit tests! And yes, Catalyst looks more like Ruby-on-Rails than Maypole. ;) Use a Bundle to install. $ perl -MCPAN -e 'install Bundle::Catalyst' $ perl -MCPAN -e 'install Bundle::Catalyst::Everything' See Catalyst::Manual::Intro for more. Thanks to the Catalyst team and all others who've helped. -- sebastian From sri@oook.de Thu Mar 10 11:08:01 2005 From: sri@oook.de (Sebastian Riedel) Date: Thu, 10 Mar 2005 12:08:01 +0100 Subject: [Maypole] Catalyst app survives slashdotting! :) Message-ID: <42302A91.9080506@oook.de> Jesse Sheidlower (the_jester in #maypole) used Catalyst for the newest incarnation of the Science Fiction Citation Project (http://www.jessesword.com/sf), which got slashdotted yesterday. http://slashdot.org/articles/05/03/09/182214.shtml?tid=214&tid=1 The server is just a poor two year old PIII 750Mhz with twin 15k SCSI drives (hardware RAID1) running Apache 1.3.31, mod_perl 1.29, MySQL and Catalyst. It not only survived, it served with a reasonable speed all the time! :) -- sebastian From sri@oook.de Thu Mar 10 11:12:26 2005 From: sri@oook.de (Sebastian Riedel) Date: Thu, 10 Mar 2005 12:12:26 +0100 Subject: [Maypole] Catalyst app survives slashdotting! :) In-Reply-To: <42302A91.9080506@oook.de> References: <42302A91.9080506@oook.de> Message-ID: <42302B9A.6050708@oook.de> Sebastian Riedel wrote: > The server is just a poor two year old PIII 750Mhz with twin 15k SCSI > drives (hardware RAID1) running Apache 1.3.31, mod_perl 1.29, MySQL > and Catalyst. Oh yeah, and it's running on FreeBSD... -- sebastian From sri@oook.de Thu Mar 10 21:49:02 2005 From: sri@oook.de (Sebastian Riedel) Date: Thu, 10 Mar 2005 22:49:02 +0100 Subject: [Maypole] Catalyst Mailinglists! Message-ID: <4230C0CE.20403@oook.de> Thanks to Danijel we now have Mailinglists for Catalyst, yay! You can subscribe at: http://lists.rawmode.org/mailman/listinfo/catalyst and http://lists.rawmode.org/mailman/listinfo/catalyst-dev We also now officially opened our irc channel #catalyst on irc.perl.org Have fun! -- sebastian From sri@oook.de Sun Mar 20 21:05:55 2005 From: sri@oook.de (Sebastian Riedel) Date: Sun, 20 Mar 2005 22:05:55 +0100 Subject: [Maypole] Testing? In-Reply-To: <423DDFEB.9020108@acm.org> References: <423DDFEB.9020108@acm.org> Message-ID: <423DE5B3.4080600@oook.de> Dave Howorth wrote: > Do any of you have a testing methodology for Maypole-based apps that > you're able to share? Catalyst has a very extensive testing framework, maybe you want to backport it. -- sebastian