Re: [Catalyst] printing the generated SQL
| From: Paul Rudolf Seebacher [EMAIL PROTECTED] | Octavian Rasnita wrote: Hi, Is it possible to log a certain SQL which is generated in a Catalyst application by a controller that uses a DBIx::Class model? Thank you. Octavian This will print out geneerated SQL on debug screen: $ export DBIC_TRACE=1 | And where should I enter this command line? | | I don't need it for a program that uses DBIx::Class which is ran from the | command line, but in a Catalyst app. [rest snipped] In your shell: # bash $ export DBIC_TRACE=1 or # csh $ setenv DBIC_TRACE 1 and then start the catalyst builtin test server like this $ ./script/myapp_server.pl or do all at once, like this $ DBIC_TRACE=1 ./script/myapp_server.pl Then point your browser to http://localhost:3000, use your app and see the SQL queries being written to your terminal. Same thing for non-catalyst scripts that use DBIC: $ DBIC_TRACE=1 ./myscript.pl HTH, Fernan ___ 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. | | Needs a Spanish translation. | (es) Por favor, vuelva más tarde. ___ 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] CMS
| On 8/23/07, John Wang [EMAIL PROTECTED] wrote: | For while I've been thinking it would be nice to have a Cat-based CMS with | multiple features built on top of a platform. The platform can include basic | things like Authn, Authz, Sessions, a basic user schema and pre-built HTML. | The pre-built HTML can include controllers/templates/etc for registration, | login/logout, openid, etc. Then on top of the platform you can have | plug-and-play features like forums, blogs, photo galleries, surveys etc. If | it was built the right way, you could have your choice of forums, etc. You | can also only load the features that you want. I'm not sure how easy this | would be to do but I think it would be neat. | | This is precisely what I DON'T want. I want something manages and | version my templates and then a view that lets Cat retrieve the | appropriate template through some means. | | Not that what you describe wouldn't be nice to have, just not for me atm. ;) don't know if this is what you were talking, but me, I'd like a pluggable combo that will allow me to add simple editing of pages (a small wiki or blog-like combo to plug into any catalyst app), with choice of markup (Markdown, Textile, WikiFormat) ... then my templating system should just inject the processed content into a template. Fernan ___ 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] overload/override sub? (Session::PerUser)
Hi, I'd like to overload (or would it be override?) the merge_session_to_user sub in Catalyst::Plugin::Session::PerUser to be able to guide the hash merge (i.e. create new hash value keys for conflicting keys). Now, where and how should I do the overriding? Excuse my ignorance ... but I've never done this and searching for 'Perl overload' always gets me to instructions on how to overload built-in operators ... Thanks in advance, Fernan ___ 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] IDE for use with Catalyst
| Hi There, | | I am taking a this week off of work and would really like to build an | application with catalyst. Does anyone have an IDE that they can | recommend? I have been developing perl apps for a while now but have | been using vi :). If anyone has any suggestions I wold love to hear | them. | vim + omniperl eclipse + epic My $0.2 Fernan ___ 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] Setting cookie_domain
+[ Bernhard Graf [EMAIL PROTECTED] (15.Apr.2007 08:23): | | Hi, | | I'm wondering how to set the cookie_domain of | Catalyst::Plugin::Session::State::Cookie when you run a site under | different domains. | | The manual only gives advice how to do this in the (static) | configuration - and from looking at the source I get the impression | that I either had to sub class and override more or less undocumented | methods or otherwise had to patch. | | Or is there a (better) third way? | +] config your app using YAML. In your lib/app.pm file add 'ConfigLoader' to the list of plugins. The good thing about this setup is tat you can have a main config file and _local overrides for similar but not identical installations. For example, you can set up an app.yml file in your main directory with the generic settings (those shared by all domains). And then place an app_local.yml file besides the app.ymlm file. This file contains just the overrides for the domain specific configuration. So for example, in app.yml you may have: session: dbic_class: mymodel::Sessions cookie_name: my_cookie expires: 0 and then for each domain you just set the cookie domain. for domain1, app_local.yml: session: dbic_class: mymodel::Sessions cookie_domain: my.domain1.com for domain2, app_local.yml: session: dbic_class: mymodel::Sessions cookie_domain: my.domain2.com With this setup the cookie name and the expiry time are equal to all domains, only the cookie domain changes. HTH, Fernan PS: check the docs for the YAML plugin, also the Catalyst::Manual::Cookbook have some nice examples there about using YAML to configure your app). ___ List: [EMAIL PROTECTED] Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Setting cookie_domain
+[ Bernhard Graf [EMAIL PROTECTED] (15.Apr.2007 16:20): | | On Sunday 15 April 2007 19:32, Fernan Aguero wrote: | +[ Bernhard Graf [EMAIL PROTECTED] (15.Apr.2007 08:23): | | Hi, | | | | I'm wondering how to set the cookie_domain of | | Catalyst::Plugin::Session::State::Cookie when you run a site under | | different domains. | | | | The manual only gives advice how to do this in the (static) | | configuration - and from looking at the source I get the impression | | that I either had to sub class and override more or less | | undocumented methods or otherwise had to patch. | | | | Or is there a (better) third way? | | +] | | config your app using YAML. In your lib/app.pm file add | 'ConfigLoader' to the list of plugins. | | The good thing about this setup is tat you can have a main | config file and _local overrides for similar but not | identical installations. | | Thank you, but this doesn't help. Because I have only one application | that can be accessed under different domains (same 2nd-level domain | with TLDs .de, .at and .ch im my case). Oh, I see. -- BTW I'm in geneva now :) | The documentation for Catalyst::Plugin::Session::State::Cookie claims | that the default value for cookie_domain is the current host, which is | not true and probably would be counterproductive. Yes I have some problems with sessions not working when I switch to using the builtin server (instead of apache under a registered domain) under localhost (for testing changes). | A sane default for cookie_domain would be something as | $cd = (/(\.[^\.]+\.[^\.]+)$/)[0] || $_ for $c-req-uri-host | giving you | .example.com for www.example.com and www.sub.example.com, | example.com for example.com and of course | mylocaltestdomain for mylocaltestdomain. | | But this is untested yet. I'd be interested to know how you do that, if your tests are successful. Fernan | -- | Bernhard Graf | | +] ___ 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] work with second database
+[ Michael Higgins [EMAIL PROTECTED] (11.Apr.2007 16:08): | | Hello, All -- | | As I'm still trying to get my head around the Catalyst way of doing things, | I'm hoping can someone give me a hint: | | I have an application set up to report on a database. So far, so good. | | Now, I've got another database I need to query. How do I best integrate | access to it into my existing application? create another model. are you using dbix::class? in my application's 'lib' directory I have: # DB1 is mapped through the model1 schema lib/myapp/Model/model1.pm lib/model1/Table1.pm lib/model1/Table2.pm ... more tables in this db # DB2 is mapped through the model2 schema lib/myapp/Model/model2.pm lib/model2/AnotherTable.pm ... more tables in this db Then in your controller´s code: my $table1_model = $c-model('model1::Table1'); my $rs = $table1_model-search( { name = 'Me' }); my $cust = $rs-first-customer; my $othermodel = $c-model('model2::AnotherTable'); my $rs2 = $othermodel-search( { customer = $cust }); Of course, you won't be able to do joins across the two databases. Fernan | Sorry for the generality of the question, but I don't even know the | terminology yet. Is this, say, going to be a 'separate namespace' or | something? | | Is there an example out there I could familiarize myself with, where a | Catalyst application uses two different databases? | | I understand I can have as many models, views and controllers as I need. I | don't understand what I need to create in order to have another model | accessed from an existing controller, or how to define that model and get it | loaded. | | Any leg up greatly appreciated. | | Cheers, | | -- | Michael Higgins | | | | ___ | 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] IE cookie/session problems
Hi! there were a couple of questions regarding issues with IE that had to do with cookie/sessions. I also experienced this, and tested one of the solutions proposed (calling $c-reset_session_expires after a succesful login). But this alone didn't fix it. After a while I noticed I had moved my site to another box, and was running my webapp under another domain, as a virtual host. After reading the cookies spec again, I noticed the following: Only hosts within the specified domain can set a cookie for a domain ... So I revisited my cookie configuration and noticed that I was only setting the cookie_name but not the domain. After I added 'cookie_domain' to my cookie conf, things started to work fine under IE. For some reason the other browsers didn't care ... maybe IE was doing the right thing this time? BTW, I also added a 'cookie_expires: 0' to make it a session cookie (not persistent), since I'm managing persistent data through authentication//db storage anyway. Hope this helps, Fernan ___ 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] Extending C::Plugin::Authentication::Store::DBIC for additional constraints
+[ Doran L. Barton [EMAIL PROTECTED] (26.Mar.2007 01:39): | | I'd like some advice on how to do this. I'm developing a single Cat app | that will handle multiple sites by looking at the 'host' header. All | sites will be associated with domain names under a specific domain. Think | wildcard A records in DNS, if you will. For example, all of the following | would be caught and handled by the app: | | foo.mycatalystsite.com | bar.mycatalystsite.com | foobar.mycatalystsite.com | | I want each site to have its own pool of users for authentication. The | users table, therefore, has a site_id associated with each user. | | Herein lies the gotcha! I need to be able to tell the Authentication plugin | to authenticate the user using $username, $password, and a site_id (as | opposed to the usual $username and $password). After looking through the | Catalyst::Plugin::Authentication::Store::DBIC code, I can't immediately see | how I could subclass it and add this functionality. | | Thoughts, anyone? | +] Certainly not what you were asking (subclassing store::dbic), but ... sub login : Local { my ( $self, $c ) = @_; my $username = $c-req-params-{username} || ; my $password = $c-req-params-{password} || ; my $model = $c-model('Users'); if ( $username $password ) { # attempt to login if ( $c-login( $username, $password ) ) { # now we check site_id $ok = $model-search( { username = $username, password = $password, site_id = $site_id } )-count(); $c-logout unless $ok 0; } } else { ... ___ 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] save session data
Hi! I'm currently using the Session, Session::Store::DBIC, and Session::State::Cookie plugins to track session data for each user. One of the things I'm doing is storing user queries into the session: $c-session-{queries} = { 1 = { deeper data structure here }, 2 = { ... }, 3 = { etc. } }; Now, these queries are only preserved during the session. I'd like to offer the possibility of saving this data and make it available across sessions. I already thought about setting the 'expires' value of the session to some extremely high value, as mentioned in the Session plugin docs, but I don't quite like the idea. I prefer to have this data associated with a userid, and not with a sessionid, so that the same user on two different machines/browsers can get at her/his queries. So I've know added authentication to my catalyst app, and I have already login/logout functionality working (Authentication, Authentication::Store::DBIC, Authentication::Credential::Password, Authorization::Roles). Now, if I want to have this session data stored into a diffent db table and with additional data, I imagine I'd have to write my own Session-Store-DBIC workalike ... or perhaps it's easier to just dump the structure, encode it somehow (base64?) and store this as text? Anyone went that path? Perhaps this wheel is already available from cpan? :) Thanks for any pointer, Fernan ___ 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] save session data
+[ Jonathan Rockway [EMAIL PROTECTED] (09.Feb.2007 17:32): | | Fernan Aguero wrote: | Anyone went that path? Perhaps this wheel is already | available from cpan? :) | | Catalyst::Plugin::Session::PerUser? | +] This seems a perfect fit, thanks! Fernan ___ 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] memory usage of mod_perl process
+[ Nilson Santos Figueiredo Junior [EMAIL PROTECTED] (08.Feb.2007 11:37): | | On 2/8/07, Fayland Lam [EMAIL PROTECTED] wrote: | but the memory usage of each process seems to be 95 m. it's pretty high! | we have more 60+ pms. | | We've got around 100+ pms and myapp_server.pl uses around 87mb of RAM. | Don't really know about usage under mod_perl, I'd need to check it out. | | -Nilson Santos F. Jr. | +] You might want to tune your apache/modperl (google 'apache modperl tuning'). http://perl.apache.org/docs/1.0/guide/performance.html But also, compare the memory usage of your modperl httpd processes, and the one of the catalyst webapp_server.pl. The comparison should give you an idea of how much overhead is coming from apache. You should evaluate if the effort of trimming apache functionality (for example by removing dynamically loaded modules) is worth it. Just as a reference, I've got ~13 Mb usage from a barebones catalyst app (create a new app and run its standalone server). While the app I'm working on (91 pms, of which ~80 are coming from the model) is running at ~150 Mb in apache/modperl (but this is not fair to catalyst because this is a heavy apache that is also running mod_python (trac/svn)) and at ~86 Mb using the standalone web server. Are you using DBIx::Class? Our DBIx::Class model is ~80 tables. Because during development we were also changing the underlying database, at one point we were running our test server using three different instances of these models, each against a different db instance. In this case, the average httpd process was huge. The mem size was reduced by ~70Mb for each model instance that we eliminated. So yes, you can gain a significant amount of memory if you trim down your db tables/schema and your DBIx::Class model. In our case those ~80 tables are there because the database is also used outside of the catalyst webapp. When development of the catalyst app stabilizes, we will go over the model and remove all .pm files for tables that the catalyst app doesn't use. Hope this helps, Fernan ___ 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] memory usage of mod_perl process
+[ Bill Moseley [EMAIL PROTECTED] (08.Feb.2007 12:16): | | On Thu, Feb 08, 2007 at 11:56:09AM +, Fayland Lam wrote: | hi, all | | we are using mod_perl to run our Catalyst App with DBIx::Class and Template. | | but the memory usage of each process seems to be 95 m. it's pretty high! | we have more 60+ pms. | | Are pms number of entries in %INC? I think this is the number of .pm modules under your application's own lib/. Or at least this is how I interpreted it. | I have 464 entries in %INC, but that's hardly a good measurement | considering how small some of the plugins are. yes, not the best way to measure it, agreed. Fernan | Top shows: | | PID USER PR NI VIRT RES SHR S %CPU %MEMTIME+ COMMAND | 26074 www-data 15 0 72188 51m 6184 S 3.3 5.1 0:07.60 apache2 | I want to ask you guys how many memory usage for your Catalyst App? and | is FastCGI any better? which one do you pick for Catalyst? mod_perl, | FastCGI and anything else? | | A lot of people seem to like FastCGI. I started out using a FastCGI | setup but restarts were taking a long time (seemed every FastCGI | process had to compile the application). I moved to mod_perl and | much happier now. | +] ___ 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] iterating twice over the same resultset in thetemplate?
+[ Brian Kirkbride [EMAIL PROTECTED] (03.Jan.2007 17:16): | [snipped] | The problem is that the resultset is empty when I try to | iterate over it the second time. | | So far the only way I've found to make this work is | to do N separate searches, fill N stash elements, et cetera | | $rs1 = $model-search( ... ); $c-stash-{rs1} = $rs1; | $rs2 = $model-search( ... ); $c-stash-{rs2} = $rs2; | ... | | [% WHILE ( it = rs1.next() ) -%] ... | [% WHILE ( it = rs2.next() ) -%] ... [snipped] | You want rs.reset() between the iterations IIRC. | +] Thanks to all who replied. rs.reset() did it. It completely escaped me when I read the Resultset.pm POD. Fernan ___ 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] iterating twice over the same resultset in the template?
[ or perhaps 'is it possible to clone a resultset?' ] Hi! I'm building a form whose elements are items taken from the db. And I need these items to show up in different elements (fieldsets) of the form. More or less something like this: With items similar to: 'checkbox' - Item 1 'checkbox' - Item 2 'checkbox' - Item 3 with parts that belong to: 'checkbox' - Item 1 'checkbox' - Item 2 'checkbox' - Item 3 In my controller: my $rs = $model-search( ... ); $c-stash-{items} = $rs; In my template (TT): form ... fieldset [% WHILE ( it = items.next() ) -%] input ... [% it.name -%] [% END -%] /fieldset fieldset [% WHILE ( it = items.next() ) -%] input ... [% it.name -%] [% END -%] /fieldset /form The problem is that the resultset is empty when I try to iterate over it the second time. So far the only way I've found to make this work is to do N separate searches, fill N stash elements, et cetera $rs1 = $model-search( ... ); $c-stash-{rs1} = $rs1; $rs2 = $model-search( ... ); $c-stash-{rs2} = $rs2; ... [% WHILE ( it = rs1.next() ) -%] ... [% WHILE ( it = rs2.next() ) -%] ... Is there any other way to do this? Is it possible to clone a resultset? Thanks, Fernan ___ 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] RESTful perl implementations...
+[ Garrett Goebel [EMAIL PROTECTED] (29.Sep.2006 20:25): | | | On Sep 29, 2006, at 5:02 PM, A. Pagaltzis wrote: | | * Garrett Goebel [EMAIL PROTECTED] [2006-09-29 14:16]: | I had thought about the HTTP/1.1 methods. However, I was only | concerned with the request methods used for creating RESTful | protocols. | | That is an oxymoron. Please don?t take this in offense, but you | don?t seem to have understood what REST is about. :-) | | From what I've read, there seem to be few people who do. It isn't | surprising to find myself among them. [snipped] | +] Here are a couple of basic descriptions: http://www.bookrags.com/wiki/Representational_State_Transfer http://en.wikipedia.org/wiki/REST http://rest.blueoxen.net/cgi-bin/wiki.pl?ShortSummaryOfRest I, for one, also had a very vague idea of REST, that's now more clear (I think). Also from what I've read, it seems that REST is defined very broadly, but in any case, the comparison of REST vs RPC (see the corresponding section in the links above) is a good choice, as it does a good job of illustrating what REST is and what it isn't, by example. Fernan ___ 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] problem deploying with apache
Hi, I've got a little catalyst test app that I want to move to apache. In my httpd.conf I added the following: IfModule perl_module PerlSwitches-I/home/fernan/proyectos/portfolio/database/Portfolio/lib PerlModule Portfolio Location /portfolio/ SetHandler mod_perl PerlResponseHandler Portfolio /Location /IfModule Now, apache is restarted normally, and when I call the http://localhost/portfolio URL, catalyst is loaded fine (debug output to /var/log/http-error.log similar to that produced by running the testapp_server.pl). However, I don't get the expected default page for my app but this error instead: Not Found The requested URL /portfolio/ was not found on this server. And this line in the httpd-error.log: [Tue Sep 05 15:11:26 2006] [error] [client 192.168.10.179] File does not exist: /usr/local/www/apache22/data/testapp/ (/usr/local/www/apache22/data/ is my DocumentRoot) I don't know why apache it's looking under the DocRoot. Is this an apache conf issue? Or a catalyst issue? I'm inclined to think the former, since an almost identical configuration for trac on mod_python works fine (accessing http://host/trac works as expected, and there's no 'trac' dir/file under DocRoot). Any ideas? Thanks in advance, Fernan ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Using model layer with DBIC::Schema
+[ Dr. Jennifer Nussbaum [EMAIL PROTECTED] (27.Jun.2006 16:54): | |Hi, Hi |im just moving some work to DBIx::Class (which im really liking!), and |i have a |question about setting up my Schemas. |The docs for Catalyst::Plugin::DBIC::Schema talk a lot about setting |up your |DBIC classes in MyApp::Schema so you can use it on it's own, and then |creating MyApp::Model::FilmDB, which calls MyApp::Schema::Film as it's |Schema Class. So you then have Model::Film which is in Catalyst but |doesnt |really exists, it's a creation of the Schema. |i want to know the best way to set up a REAL Model::Film with DBIC. If I understand what you want to do, what you want is something like this: CatalystApp/ script/ root/ lib/ Catalyst.pm Catalyst/ Controller/ View/ Model/ DB.pm - references Catalyst::DB DB.pm - this is Catalyst::DB DB/ - here are all your DBIx classes Users.pm Recipes.pm Tracks.pm Albums.pm Etcetera.pm |That is, |i have a Catalyst Controller that needs a model to do things relating |to CATALYST. i want my controller to pass $c to a model that can do a |bunch of |Catalyst related things, and IT calls my DBIC class. In other words i |want a |model layer in Catalyst that calls my fixed, not-Catalyst model in |MyApp::Schema. I'm also new here so don't take my word for it, but I'm not passing anything to my model ... at least the way I think of it, I'm USING my model from within the controller: in Controller/Discs.pm sub search : Global { ( my $self, $context ) = @_; my $album = $context-model( 'DB::Albums' ); my $search_string = $context-request-param( 'search_string' ); my $resultset = $album-search_like( { album_name = %$search_string% }); $context-stash-{albums} = $resultset; $context-stash-{template} = 'albums.tt'; } |Is there a recomended way of doing this with the Catalyst plugin You have to run your helper script application_create.pl to create a model for you, like this: supposing you want to call your model 'DB' ./script/app_create.pl model DB DBIC 'dbi:mysql:dbname=mydb ... this will generate the CatalystApp/lib/Catalyst/Model directory and will put a DB.pm in there | or a recomended way of doing it from scratch? you can create the necessary directories by hand and write your own DB.pm to put in Model/ package Catalyst::Model::DB; use strict; use base 'Catalyst::Model::DBIC::Schema'; __PACKAGE__-config( schema_class = 'Catalyst::DB', connect_info = [ 'dbi:mysql:dbname=', 'user', 'passwd' ] ); 1; that's it! Of course you may want to put your DBIx classes and modules elsewhere (here I've put them inside the 'lib' directory of my catalyst app, at the same level of 'Controller', 'Model', etc.), provided they're available for perl. In that case, change the 'schema_class' in your Catalyst/Model/DB.pm to point to it. Hope this helps, Fernan |Thank you! |Jen | +] ___ 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/