Re: [Catalyst] The model -is- where your business logic lives.

2007-09-27 Thread Matt S Trout
On Thu, Sep 27, 2007 at 11:51:26AM +0100, Ian Docherty wrote:
 In a previous thread, Matt S Trout said.
 
 The model -is- where your business logic lives.
 
 The real question is whether your ORM should be directly in the model or
 not, but that's a whole different thread.
 
 Based on this I have the following simple code.
 
 
 package MyApp::Model::DBIC;
 
 use strict;
 use base qw(Catalyst::Model::DBIC::Schema);
 
 
 package MyApp::Schema::Demo;
 
 use base qw(DBIx::Class);
 
 __PACKAGE__-load_components(qw(PK::Auto Core));
 __PACKAGE__-table('demo');
 __PACKAGE__-add_columns(qw(id name state));
 __PACKAGE__-set_primary_key('id');
 
 
 
 package MyApp::Model::DBIC::Demo;

Put this code in MyApp::Schema::Demo.

I often call it e.g. MyApp::DataStore or MyApp::Domain to remind me that
it's the business layer and the DBIC-ness is merely incidental.
 
 sub do_some_business_logic_stuff {
my ($self) = @_;
 
if (some complicated business logic) {
$self-state('pending');
$self-update;
}
 }   
 
 
  somewhere in my application
 
 $demo = $c-model('DBIC::Demo')-find($index);
 $demo-do_some_business_logic_stuff;
 
 -
 
 Is this a standard/typical/best-practice way to do this sort of thing? 
 
 It seems to me that if I want to use the business logic in an external 
 application (cronjob) then I am having to use the MyApp::Model::DBIC::Demo 
 namespace as decreed by Catalyst (not that this is a big issue).

Having moved the logic out of MyApp::Model:: this ceases to be an issue.

Don't confuse class -names- with the nature of classes. MyApp::Model:: is
*adapters* that make a model available to MyApp, not where your domain model
logic itself should live.

I usually these days have MyApp::Web for the catalyst app instead of MyApp so
I can deploy things like MyApp::DataStore from a separate dir tree.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

___
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] Can't find my canary

2007-09-24 Thread Matt S Trout
On Mon, Sep 24, 2007 at 09:35:47AM -0700, Dennis Daupert wrote:
 Dennis:
  Did your fix not get to git yet?
 
 Jonathan:
  It's there now. On my machines, Session::State::Cookie still isn't
  working, so tests fail for me. But if they pass for you, 
  you should be good to go. 
 
 I bypassed s-s-cookie, manually installed c-p-FormCanary, but
 the magic isn't working for me yet.
 
 I have a question based on this code snippet:
  #=
  if ($content_type =~ /html/){
some stuff here...
# add the input tags to the body
my $body = $c-response-body;
$body =~ # yuck.
  s{/form}
   {input type=hidden name=$name id=$name value=$canary /
/form}g;
$c-log-debug($body); #  I added debug msg
$c-response-body($body);
  }
  return $c-NEXT::finalize_session(@_);
  #=
 
 Here's what I do not understand:
 
 The canary hidden input tag IS ADDED, according to $c-log-debug($body)

It's being added after the body's sent to the browser.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

___
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] CatalystX::CRUD

2007-09-24 Thread Matt S Trout
On Mon, Sep 24, 2007 at 10:23:11AM -0500, Peter Karman wrote:
 
 
 On 09/23/2007 11:24 AM, Matt S Trout wrote:
  On Fri, Sep 21, 2007 at 08:57:35AM -0500, Peter Karman wrote:
 
  CXCM subclasses would need to implement at least the following methods:
 
   * new_object  - returns CatalystX::CRUD::Object-new()
   * fetch   - returns CatalystX::CRUD::Object-new()-read()
   * search  - returns zero or more CXCO instances as an arrayref
   * interator   - like search() but returns an iterator
   * count   - like search() but returns an integer
  
  Have you looked at the way the Handel storage stuff works? That already
  supports both DBIC and RDBO so might be an interesting start.
  
 
 I have looked through it (I had to figure out that Handel-Storage-RDBO is
 packaged separately...) and it looks like the base Storage API is much more
 complex and full-featured than what I am suggesting. But all the methods I
 mention are there in one or another. I'll probably dig in to the DBIC
 implementation when/if I need help with that part of CXCM (/me hoping not 
 write
 that all by myself...).

Yeah, don't blame you :)
 
  Do you have any thoughts on how to paper over DBIC's ability to chain 
  searches
  vs. the lack of that feature in RDBO? I know most RDBO users don't feel
  they're deprived not having it but DBIC users are generally fairly addicted 
  :)
  
 
 I've read about that feature difference in the mail archives, but since I
 haven't used DBIC myself, other than to just play for about an hour, I'm not
 sure what the equivalent RDBO code would look like. I do all kinds of multiple
 relationships in my RDBO code, where I chain together method calls to get at
 related data. Is the difference that RDBO might be making multiple db calls,
 whereas DBIC doesn't?
 
 For example, in your reply to Perrin you used this example:
 
  This sort of thing in DBIC just becomes
 
  $posts_rs = $users_rs-search_related('posts');
 
 In RDBO, if I wanted all the posts for a given user, I might just say:
 
  $posts = $user-posts;
 
 So how is that different? Because $users_rs might represent multiple users? If
 so, yes RDBO would require something a little longer, like:
 
  map { push @posts, $_-posts } @$users;
 
 Which, depending on if I pre-fetched the posts when creating $users, might end
 up being lots more trips to the db. And it doesn't give me $posts_iterator,
 which might be preferable to @posts.

The main diff here is the DBIC users_rs could represent many users without
ever actually fetching them.

Looking at your example though, I think I'm worrying too much.

 But I think for the purposes of this CatalystX::CRUD proposal, the harder
 issues are going to be abstracting the conversion of $c-params() to what gets
 passed to search(), iterator(), count(), etc. Right now that is all very
 RDBO-specific in CCR::Search.
 
 Couldn't the whole DBIC search_related issue just be resolved by pushing the
 issue out into the controller and/or view space? In your CCR::Search subclass:
 
  my $results = $c-model('My::CatX::CRUD::Model::DBIC')
   -search(@params)-search_related('foo');

I think we'd just end up providing traverse_related methods that did stuff.

The RDBO implementation might be a little less efficient than the DBIC one
but for the sort of workload we're looking at here it's probably -fairly-
academic performance-wise.

And if it's not, you can go bug siracusa until that changes :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

___
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] Catalyst::Controller::Rose::Simple

2007-09-23 Thread Matt S Trout
On Fri, Sep 21, 2007 at 08:29:26AM +0200, Alexandre Jousset wrote:
 Peter Karman a écrit :
 Alexandre Jousset wrote on 9/20/07 11:41 AM:
 I'm sure I haven't your experience but for me (and also for Peter 
 Karman, C::C::Rose author), the suffix ::Simple (suggested by him) 
 means Take all that [what already exists, i.e. Catalyst and Rose] and 
 make it simpler to use together.
 
 Actually, I had suggested you use ::Simple because in your original 
 email to me, (a) you had indicated you intended to use C::C::Rose, but 
 with an API similar to the FormBuilder philosophy, and (b) you had a 
 working title of C::C::Rose::FormManager, which I thought would be 
 misleading, since all the existing C::C::Rose::* classes also manage forms.
 
   First, I am sorry to have spoken for you. I thought we were OK on 
   that...
 
 As you indicate below, you don't use any of the C::C::Rose code, design 
 or philosophy, so sharing the namespace seems misleading at the very least.
 So I'd prefer it if you used a difference namespace altogether. I 
 believe the latest best practice recommendation is to use the CatalystX 
 top-level space. Perhaps something like CatalystX::RHTMLOManager or 
 similar.
 
   Well... I don't mind to call it something else, so now I'm just 
   (once again) looking for a good name. CatalystX::Something, ok. 
 CatalystX::RHTMLOManager, NOK because it also deals optionally with RDBO 
 and I would like to mention this fact, and I think the best way is to 
 use the Rose name.

I think you should just rewrite the damn thing to use Controller::Rose.

That seems like a much better idea to me since Peter Karman's code is already
pretty stable and provides most of the things you need.

Just provide a different interface on top.

Re-inventing wheels is not the Catalyst way. If you want to write everything
from scratch every time, might I recommend PHP.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

___
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] Catalyst::Model::Search

2007-09-23 Thread Matt S Trout
On Fri, Sep 21, 2007 at 10:00:14AM -0500, Peter Karman wrote:
 
 
 On 09/21/2007 09:39 AM, Jonathan Rockway wrote:
  Peter Karman wrote:
  I see Catalyst::Model::Search on CPAN now. As the maintainer of
  Catalyst::Model::SWISH, I'd love to get in on that namespace action. Is
  Catalyst::Model::Search intentionally undocumented? Are there plans for a
  formal API to which subclasses of Catalyst::Model::Search must adhere?

  
  People can upload whatever they want to CPAN for any reason with any
  name :)  Please mail the maintainer directly and collaborate with him. 
  If there's something seriously wrong with the module (no docs for an
  important namespace like Search is a good reason), please let the core
  team know on the dev list, and we'll do what we can to make sure the
  users of the module have the best experience possible.
 
 The C::M::Search package is under Marcus Ramberg's acct, though the author
 listed in the POD is Andy Grundman. Since both those gentlemen are core devs, 
 I
 figured this list was as good as any, especially since the resulting
 conversation might be of interest to all Catalyst users. But I'll write to 
 them
 directly as you suggest.

No, leave the discussion on here. John's just uninformed as usual.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

___
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] CatalystX::CRUD

2007-09-23 Thread Matt S Trout
On Fri, Sep 21, 2007 at 08:57:35AM -0500, Peter Karman wrote:
 I've been thinking the last couple days about ways to expand
 Catalyst::Controller::Rose to play more nicely with other models besides
 C::M::RDBO. This is per mst's request to open up the RHTMLO goodness to
 non-RDBO users, and because I now find myself wanting the same thing. I have a
 model that isn't RDBO that I'd like to use in a project.
 
 So I'm proposing the following -- comments/criticism welcome.
 
 * CatalystX::CRUD::Model (CXCM)
 
 A base class for CRUD-like models. CXCM isa Catalyst::Model. Any CXCM subclass
 could be used with the C::C::Rose classes (or any other controller that 
 decided
 to adhere to the CXCM API). C::M::RDBO would become a CXCM subclass.
 
 CXCM subclasses would need to implement at least the following methods:
 
  * new_object  - returns CatalystX::CRUD::Object-new()
  * fetch   - returns CatalystX::CRUD::Object-new()-read()
  * search  - returns zero or more CXCO instances as an arrayref
  * interator   - like search() but returns an iterator
  * count   - like search() but returns an integer

Have you looked at the way the Handel storage stuff works? That already
supports both DBIC and RDBO so might be an interesting start.

Do you have any thoughts on how to paper over DBIC's ability to chain searches
vs. the lack of that feature in RDBO? I know most RDBO users don't feel
they're deprived not having it but DBIC users are generally fairly addicted :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

___
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] CatalystX::CRUD

2007-09-23 Thread Matt S Trout
On Sun, Sep 23, 2007 at 01:42:00PM -0400, Perrin Harkins wrote:
 On 9/23/07, Matt S Trout [EMAIL PROTECTED] wrote:
  Do you have any thoughts on how to paper over DBIC's ability to chain 
  searches
  vs. the lack of that feature in RDBO?
 
 Isn't it primarily a way to build up your search criteria with
 multiple small method calls instead of one big one?  It doesn't seem
 very relevant to a CRUD app where all the criteria come in at once
 from a web form.

You've never implemented a saved search function that allows you to
'search within' a saved search?

You've never done a view all posts owned by the selected set of users link?

This sort of thing in DBIC just becomes

$posts_rs = $users_rs-search_related('posts');

whereas (so far as I'm aware, please do correct me if I'm wrong) it's a bit
more work in RDBO.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

___
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] CatalystX::CRUD

2007-09-23 Thread Matt S Trout
On Sun, Sep 23, 2007 at 09:31:35PM -0400, Perrin Harkins wrote:
 On 9/23/07, Matt S Trout [EMAIL PROTECTED] wrote:
  You've never done a view all posts owned by the selected set of users 
  link?
 
  This sort of thing in DBIC just becomes
 
  $posts_rs = $users_rs-search_related('posts');
 
  whereas (so far as I'm aware, please do correct me if I'm wrong) it's a bit
  more work in RDBO.
 
 I'm not an expert on RDBO, but I believe you would need to call a
 different class (the posts class, not the users) and adjust the
 criteria you pass, e.g. change last_name = 'Smith' to
 user.last_name = 'Smith'.
 
 Any set of ORM tools is going to have different unique features, and a
 full abstraction would mean giving up all of the unique features.
 However, it looked like Peter was trying to do something at a pretty
 high level where hopefully the differences don't come into play much.

So the answer is no, I don't have any ideas about this. Sure, fair enough.
You could have said that in one line though, I was only wondering.

I'll wait and see whether Peter does.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

___
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] Audit logs: model or controller?

2007-09-17 Thread Matt S Trout
On Mon, Sep 17, 2007 at 12:55:52PM +0100, Ton Voon wrote:
 Hi!
 
 I have a requirement for adding an audit log of certain actions  
 (creating an object, editing the object, etc) to our web app. In my  
 mind, it is best to do this at the model, so it is consistent  
 regardless of the method of access.

The DBIx-Class-Journal stuff in trunk is pretty good for this, needs more
testing before we ship it but basically there.

 However, one key bit of information I'd like to save is the user at  
 the web app level. But this is not passed to the model. What would be  
 a good way of having that information passed to the model (I was  
 thinking of setting an environment variable at the start of a request  
 and then removing it at the end)? Or is it best to have audit logs at  
 the controller?

I tend to use DBIx::Class::Schema::RestrictWithObject
+ Catalyst::Component::InstancePerContext a lot and use the current user as
the restricting object, which mostly makes this go away.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

___
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] Some guidance needed please

2007-09-14 Thread Matt S Trout
On Fri, Sep 14, 2007 at 12:43:15PM +0100, Simon Wilcox wrote:
 Matt S Trout wrote:
 
 The docs are correct.
 
 That's just completely the wrong place for the create_limited method.
 
 I'd better read them more thoroughly then :-)
 
 I'm coming at this as an ex-Class::DBI user who uses DBIx::Class every 
 few months. Each time I come into contact with it the state of the art 
 has moved on so much it feels like I'm re-learning everything. But that 
 is most definitely my problem !
 
 I appreciate that RTFM is the right way to go but could you give me a 
 clue as where the right place for the create_limited method would be ?

Rule of thumb: If it would have been a class method in CDBI code it probably
wants to be a resultset method in DBIC.

As I noted in my initial reply to the OP though, I'd probably override
insert+update on my user object to call an _add_pw_to_used_list method or
similar; whether that then calls a create_limited resultset method for
usedpassword or handles the logic itself doesn't strike me as that important.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Best way to validate Chained actions?

2007-09-13 Thread Matt S Trout
On Thu, Sep 13, 2007 at 08:41:24AM -0400, Christopher H. Laco wrote:
 Micah Jaffe wrote:
  I'm trying to figure out the best[*] way to validate Chained actions at
  various points along the action chain.  By validate, I mean check if
  the action should proceed or bomb out.  Validation is not the same as
  authentication; I may be logged in but I may not have permissions to do
  certain things.  It may also mean proceeding is not possible because
  there is some bad data introduced in one of the links.  Let's take a
  simple chain where I want to check whether or not a user can perform
  basic CRUD type things on our data.
  Given two paths:
  
  /bigthing/id
  /bigthing/id/edit
  
  I was building this chain as:
  
  load-bigthing-data - check_read - view
   - check_update - edit
  
  Now this gets convoluted when I want to act on sub part of bigthing. 
  Say we have action paths that resemble something like:
  
  /bigthing/id/smallthing/id_2
  /bigthing/id/smallthing/id_2/edit
 
 This brings me to a related question that always bugs the hell out of me
 about using Chained.
 
 Right now, if you use PathPrefix
 (http://use.perl.org/~LTjake/journal/31738), you end up with a
 controller that can be subclassed and renamed without changing any code.
 
 In other words, ::BigThing could be renamed to MyThing, the chained uri
 follow suit from /bigthing/ to /smallthing/ and everyone is happy.
 
 The minute you add a child class into the mix (SmallThing), you have to
  hardcode Chained in SmallThing with the name/private/path pointing to
 BigThing.

Somebody needs to implement :Chained(../something).

Given the number of things I'm working on atm, it's unlikely to be me.

Patches welcome :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Some guidance needed please

2007-09-13 Thread Matt S Trout
On Thu, Sep 13, 2007 at 10:58:08AM +0100, Ian Docherty wrote:
 I have found a thread on DBIx-class mailing list that throws some light 
 on this using
 
 http://search.cpan.org/~ash/DBIx-Class-0.08006/lib/DBIx/Class/Schema.pm#load_namespaces
 
 This seems to solve the problem for putting such logic into the 
 Model/Schema but would it be better to put this type of logic into a 
 business logic layer? In which case how would I obtain a $schema object? 
 Would I have to then pass this as a parameter to the method?

The model -is- where your business logic lives.

The real question is whether your ORM should be directly in the model or
not, but that's a whole different thread.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] printing the generated SQL

2007-09-13 Thread Matt S Trout
On Thu, Sep 13, 2007 at 03:35:46PM +0300, 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?

Yes.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Some guidance needed please

2007-09-13 Thread Matt S Trout
On Thu, Sep 13, 2007 at 10:27:04AM +0100, Ian Docherty wrote:
 Hi
 
 My existing Catalyst application is being extended. I want to keep a 
 record of previous passwords used by a user to prevent them being re-used.
 
 I have Model 'UsedPassword' to keep track of the previous 8 (say) 
 passwords as so-
 
 package MyApp::Schema::UsedPassword;
 use strict;
 use base qw(DBIx::Class);
 
 __PACKAGE__-load_components(qw(PK::Auto Core));
 __PACKAGE__-table('used_password');
 __PACKAGE__-add_columns(qw(id user password));
 __PACKAGE__-set_primary_key('id');
 
 So, if I want a method (create_limited) to create a new UsedPassword 
 object, that ensures no more that 8 (say) passwords are stored in the 
 database (against each User) where should it go?
 
 Ideally (I think) I would like to do something like
 
   $c-model('DBIC::UsedPassword')-create_limited({
   user= $user-id,
   password = $password,
   });
 
 but i can't see how to add it to MyApp::Schema::UsedPassword (since 
 $c-model('DBIC::UsedPassword') returns a ResultSet not a 
 MyApp::Schema::UsedPassword)
 
 Any other suggestions where to put it (polite one's only please)?
   ^^ BLAM!

Why not just have it as

$user-_add_to_used_passwords

and then hook that into $user-insert + -update ?

Perhaps better still, why not just make this a trigger? (unless you're using
MySQL, in which case s/make this a trigger/use a database/ :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Some guidance needed please

2007-09-13 Thread Matt S Trout
On Thu, Sep 13, 2007 at 03:14:58PM +0100, Ian Docherty wrote:
 Simon Wilcox wrote:
 Will Hawes wrote:
 
 Whoops, my bad. $c-model() does indeed return a 
 DBIx::Class::ResultSet, so you would need to retrieve/create an 
 instance of your UsedPassword class from the resultset in order to 
 call any methods on it:
 
 my $used_password = $c-model('DBIC::UsedPassword')-create( { user 
 = 'user', password = 'password' } );
 $used_password-foo_method()
 
 IIRC, can't you get the original record source back from the resultset ?
 
 my $used_password = 
 $c-model('DBIC::UsedPassword')-result_source-create_limited();
 
 S.
 Almost, if I do my $used_password = 
 $c-model('DBIC::UsedPassword')-result_class-create_limited();
 
 it works. So that should do for now, thanks Simon and Will for your help ;)

No. Don't do that.

Really don't.

It's utterly broken.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Weird -d flag and txn_do interaction...

2007-09-12 Thread Matt S Trout
On Mon, Sep 10, 2007 at 09:06:07AM +0200, Marcello Romani wrote:
 Matt S Trout ha scritto:
 On Mon, Aug 27, 2007 at 05:10:23PM +0200, Marcello Romani wrote:
 Hi,
 I'm developing an app using cat and dbic, with postgresql 8.1.
 I've got a table with a unique column.
 
 When I try to insert a record that violates that constraint (the code is 
 executed via txn_do($coderef)), I obviously get an exception from DBIC.
 
 The problem is that if I run myapp_server without the -d flag, the 
 exception string is correct; but if I run it _with_ the -d flag istead, 
 the error gets cleared by a SELECT(*) COUNT executed with apparently no 
 reason after the failing INSERT() query.
 Therefore the error string I get is something like command ignored 
 until end of transaction block.
 
 Something's numifying the $rs thus causing -count to be called.
 
 
 Thanks for the tip.
 I suspect is't something out of my control, otherwise the problem would 
 show up also when I'm not using the -d flag, right ?
 I'd like to track this problem down, but I think I'll have to dive into 
 the internals of cat and/or dbic... which I'm not familiar with.
 Do you have any other suggestion for where to start looking for 
 differences in behaviour between -d and normal run ?
 Thank you again.

It may be when the debugger displays the rs.

I'm not really sure, I don't ever use the perl debugger - I'm a you can
have printf/warn when you pry it from my cold, dead fingers sort of dev :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] How to use querylog plugin...

2007-09-12 Thread Matt S Trout
On Wed, Sep 12, 2007 at 04:13:36PM +0200, Marcello Romani wrote:
 Hallo,
 I've installed C::P::QueryLog and installed the template provided 
 by the pod doc, but I always get 0.00 seconds of elapsed time, no matter 
 how many db accesses I do.

Uninstall it and use the replacement model mixin the author wrote after
discussions on here about why it shouldn't have been a plugin.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Re: a noob delete/cascade problem

2007-09-12 Thread Matt S Trout
On Tue, Sep 11, 2007 at 10:20:50PM -0700, Dustin Suchter wrote:
 Well, I found a solution to my problem. I'm not sure it is the most
 elegant, but here goes:
 
 I figured that just putting the proper cascade logic into my actual
 DB schema would fix things, and it does. I changed my table
 definition to:

 I think a better solution (TIMTOWTDI) is to for DBIx to somehow
 automatically detect the constraint and transact a delete that
 removes the child rows first and then the parent rows, in order to
 make sure everything gets deleted. I think that one is a pipe dream
 so I'll happily use my solution above for now.

Couple of notes:

(1) it's DBIx::Class, DBIx:: is the namespace for -all- DBI extensions
(2) it has its own mailing list

As for automatically detecting the constraint, if you use $schema-deploy to
let DBIC generate your CREATE TABLE statements for you it puts in the
constraint cascades automatically so you'll never see a problem.

We intentionally don't override cascade/fk settings on your database to avoid
buggy code causing mass dataloss (I've seen this many times before now with
ORMs that try to be helpful the way you're requesting) - DBIC -will- try the
delete -after- deleting the main record for DBs like SQLite without FKs, but
in the case where your database has constraints DBIx::Class prefers to respect
them.

Either do the cascade clearly in your own code or make sure your DB schema's
correct - at least that way when a cascade wipes out a load of data it's
easy for the maintenance programmer to see why and how it's happened :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] unbuffered output via multiple templates

2007-09-05 Thread Matt S Trout
On Thu, Aug 30, 2007 at 07:22:38PM -0600, Todd Harris wrote:
 Hi all -
 
 Quick introduction:  I'm new to Catalys, but I've been reading the
 mailing list online for some time.  I finally have a suitable project
 and have just started working on it.  The documentation on list so far
 have been a great help.
 
 My question:  I'd like to unbuffer output a la $|++.  I thought one
 approach might be to have a series of templates per page, rendering
 each sequentially, delivering each to the client in turn.
 
 So far I've come across two possible solutions: 1. SubRequest and 2.
 View::TT-render.
 
 But it seems that trapping the output of either and writing to STDOUT
 closes the request, such that only the first template is rendered and
 sent to the browser.

$c-finalize_headers;

foreach my $argset (@argsets) {
  $c-write($c-view($view_name)-render($template, $argset));
}

or code to that effect.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Re: Catalyst::Plugin::DBIC::QueryLog

2007-09-04 Thread Matt S Trout
On Tue, Sep 04, 2007 at 01:19:31AM +, Fayland Lam wrote:
 Matt S Trout wrote:
 On Sat, Sep 01, 2007 at 04:08:09AM +, Fayland Lam wrote:
 hi, guys.
 
 since I can't touch Cory Watson by [EMAIL PROTECTED] mailto:[EMAIL 
 PROTECTED]
 so I wonder if this module is fine?
 
 No, it's awful. There's no reason at all for this to be a plugin.
 
 I'd suggest you make it a mixin for Catalyst::Model::DBIC::Schema instead.
 
 
 but it depends on every request. it start at the sub prepare and end 
 before finalize_body. due to my limited knowledge, I'm not sure if it's 
 OK as a mixin for Catalyst::Model::DBIC::Schema

I'm sure it is.

You just have a per-request query log.

That's trivial with Catalyst::Component::InstancePerContext.
 
 
 (otherwise how do you deal with two DBIC models each with their own
 querylog etc. etc.)
 
 that's right. but there is more than one way to do it. :)

Yes, but yours is wrong.

We've documented this clearly in ExtendingCatalyst - if it doesn't need
to affect the request cycle, it shouldn't be a plugin.

Please send me an htpasswd line so I can set up Model::DBIC::Schema::QueryLog
dirs for you (or consider just submitting a patch to M::DBIC::Schema itself,
which I'd be happy to help with)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Catalyst + RHTMLO

2007-09-04 Thread Matt S Trout
On Tue, Sep 04, 2007 at 11:31:57AM +0200, Tobias Kremer wrote:
 Is anybody here using Catalyst + RHTMLO, especially Rose::HTML::Form, to 
 handle
 forms? If yes, I'd like to know what your glue code (init forms from db,
 re-fill from $c-req-params etc.) looks like because RHTMLO has a somewhat
 different approach to handling things and I have the feeling that I'm doing
 things overly complicated.
 
 Other than that, I really like the way RHTMLO works and would love to see
 something like a Catalyst::Controller::RHTMLO module which works similar to 
 the
 other form controllers out there. The existing C::C::Rose module is tied to 
 RDBO
 and thus of no use for me because I very much prefer DBIC.

The ::Rose author seemed perfectly willing to make it work with DBIC, but
since he doesn't use DBIC he doesn't know what you'd need (just like I couldn't
write it due to not using RHTMLO :).

Maybe if you try and outline what you'd like from an API POV something could
be done?

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Re: Catalyst::Plugin::DBIC::QueryLog

2007-09-04 Thread Matt S Trout
On Tue, Sep 04, 2007 at 12:02:14PM +, Fayland Lam wrote:
 Jonathan Rockway wrote:
 Fayland Lam wrote:
 see attachment. check if it's OK?
 
 now it's not per request any more. hmm, after several requests,
 mst wrote:
 That's trivial with Catalyst::Component::InstancePerContext.
 
 He intended for you to use that. 
 
 It implements the per-request magic for you with some clever use of
 ACCEPT_CONTEXT and the stash.  Basically, it calls your builder method
 if you don't already have an instance in $c-stash.  Since that gets
 cleared every request, you get your per-request.
 
 So, try again :)  You're almost there :)
 
 
 Thank God. it works now. :)
 plz have a check, then I'll commit it to Catalyst trunk and release as a 
 CPAN module.

Beautiful.

fayland++

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] uri_for adding :443 to URL when HTTPS=on

2007-09-04 Thread Matt S Trout
On Tue, Sep 04, 2007 at 11:24:43PM +1000, Charlie Garrison wrote:
 Good evening,
 
 On 3/9/07 at 7:54 PM +0100, Matt S Trout 
 [EMAIL PROTECTED] wrote:
 
  The above error makes sense in the context of 
 frontend/backend  apache with rewrite rules.
   RewriteRule ^/login(.*)$ 
 http://%{HTTP_HOST}:8627/progs/login$1 [P]
  RewriteRule ^/progs/(.*)$
 http://%{HTTP_HOST}:8627/progs/$1 [P]
 
 That's kinda broken, it's relying on the request header which a browser
 could easily cock up.
 
 Fair enough, although I've seen heaps of examples using 
 %{HTTP_HOST} so I followed along.
 
 I suspect %{REMOTE_HOST} would be better (see the mod_rewrite docs for
 more info)
 
 REMOTE_HOST seems to be the client host name, not the server. So 
 I don't think that's the one you meant. Did you mean SERVER_NAME 
 instead? Since SERVER_NAME seems to give the value I expect, 
 I'll switch to using that.

Damn. Yes, sorry.

Rewrite setup configs always fall out of my head if I don't do one for a
few days.

 Still doesn't really solve the core 
 issue though.

I thought the core issue was that your rewrite rules were broken?

 When I generate a URI string with $c-uri_for(...) and HTTPS=on, 
 then I get :443 as part of the URI string. What can I do in my 
 Catalyst config (or elsewhere) to prevent :443 being included in 
 the URI string?

Have you checked to see what your webserver's giving Catalyst? I'm not
sure this isn't just uri_for naively working with what the webserver gives
it.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] FastCGI config for standalone mode

2007-09-04 Thread Matt S Trout
On Thu, Aug 30, 2007 at 11:42:51PM +0100, Will Hawes wrote:
 I've set up a Catalyst app with Apache2 and FastCGI using the config
 described under Standalone server mode at
 http://search.cpan.org/~jrockway/Catalyst-Manual-5.701002/lib/Catalyst/Manual/Cookbook.pod#Standalone_server_mode.
 Everything works fine when the FastCGI server is running via the helper
 script and I can use the app without problems.
 
 The docs state that when the backend FastCGI server is down, Apache will
 return a 502 error. The suggestion is to use an ErrorDocument directive to
 display a down for maintenance page when this is the case. However, Apache
 is actually returning a 500 error, not a 502. Apache's error log contains
 only the following:

This may be a stupid suggestion.

But wouldn't it be more useful to just trap 500s for a general sorry page
and have a static page httpd.conf you can use during maint?

It's not like your fcgi server should ever really be down except when
you're fucking with the backend DB or whatever

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Should CATALYST_DEBUG suppress manual calls to $c-log-debug()?

2007-09-03 Thread Matt S Trout
On Mon, Aug 27, 2007 at 05:38:26AM -0700, Jonathan Swartz wrote:
 
 On Aug 25, 2007, at 3:17 PM, Matt S Trout wrote:
 
 On Fri, Aug 24, 2007 at 10:15:37PM +0100, Will Hawes wrote:
 I've been trying unsuccessfully to disable all debug messages  
 while running
 tests on my app with prove. Setting CATALYST_DEBUG=0 eliminates  
 all the test
 server debug output such as the list of loaded actions, but i am  
 still
 seeing the output of every call made to $c-log-debug by my  
 controller
 code.
 
 As far as I can see the docs regarding CATALYST_DEBUG=0 don't make  
 any
 distinction about where debug messages originate, only that they are
 suppressed, which presumably means I shouldn't be seeing any debug  
 output at
 all.
 
 Is my mistake in misunderstanding how $c-log-debug() is supposed  
 to work?
 
 Yes.
 
 That logs a message of level 'debug'.
 
 The internal Catalyst debugging aid stuff checks $c-debug and if  
 so logs
 messages with the debug level. But that doesn't mean turning off  
 the internal
 debugging changes the configuration of your logger whatsoever.
 
 
 But what's the point of using $c-debug to gate debug messages when  
 you could just check $log-is_debug? It is confusing to have some  
 debug log messages in the system gated on $c-debug, and others just  
 on $log-is_debug.

$c-debug is turn on CATALYST INTERNALS DEBUG INFO.

I can turn that off and still have debug-level messages from my application
code passed by my logger.

This is a feature.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Weird -d flag and txn_do interaction...

2007-09-03 Thread Matt S Trout
On Mon, Aug 27, 2007 at 05:10:23PM +0200, Marcello Romani wrote:
 Hi,
 I'm developing an app using cat and dbic, with postgresql 8.1.
 I've got a table with a unique column.
 
 When I try to insert a record that violates that constraint (the code is 
 executed via txn_do($coderef)), I obviously get an exception from DBIC.
 
 The problem is that if I run myapp_server without the -d flag, the 
 exception string is correct; but if I run it _with_ the -d flag istead, 
 the error gets cleared by a SELECT(*) COUNT executed with apparently no 
 reason after the failing INSERT() query.
 Therefore the error string I get is something like command ignored 
 until end of transaction block.

Something's numifying the $rs thus causing -count to be called.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Is there any way to change the catalyst model parameters at the runtime ?

2007-09-03 Thread Matt S Trout
On Mon, Aug 27, 2007 at 11:20:10PM +0900, Matt Rosin wrote:
 I'm curious. I was asked to clone an existing catalyst system so a
 different database would be used depending on the url. Doesn't seem
 like a good idea unless it is a completely separate code base...

Done this with Model::DBIC::Schema.

Works fine.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] uri_for adding :443 to URL when HTTPS=on

2007-09-03 Thread Matt S Trout
On Tue, Aug 28, 2007 at 08:34:16PM +1000, Charlie Garrison wrote:
 Good evening,
 
 I upgraded Catalyst-Runtime from 5.7007 to 5.7010 yesterday; and 
 that seems to be the cause of this problem. But it could have 
 been there before and it was never reported by our users.
 
 When users try to login https://www.resultsplus.com.au/progs/, 
 the following error is returned:
 
 Bad Request
 Your browser sent a request that this server could not understand.
 Client sent malformed Host header
 Apache/1.3.29 Server at www.resultsplus.com.au:443:8627 
 Port 443
 
 Catalyst is doing a redirect to the login page using:
 
 $c-response-redirect($c-uri_for('/login'));
 
 As far as I can tell, that is when :443 is being added to the URL.
 
 The above error makes sense in the context of frontend/backend 
 apache with rewrite rules.
 
 RewriteRule ^/login(.*)$
 http://%{HTTP_HOST}:8627/progs/login$1 [P]
 RewriteRule ^/progs/(.*)$   
 http://%{HTTP_HOST}:8627/progs/$1 [P]

That's kinda broken, it's relying on the request header which a browser
could easily cock up.

I suspect %{REMOTE_HOST} would be better (see the mod_rewrite docs for
more info)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Attribute::Handlers wont work in own classes under catalyst

2007-09-03 Thread Matt S Trout
On Thu, Aug 30, 2007 at 11:54:10AM +0200, Felix Antonius Wilhelm Ostmann wrote:
 i found this bug ... Attribute::Handles has a CHECK {} block ... and 
 under catalyst this block wont be executed ... but Attribute::Handlers 
 need that ... what is to do?

CHECK and INIT blocks don't work properly.

Any code that uses them will randomly break in dynamic loading environments
like Catalyst.

Please don't file a bug report for this, perl 5.10 introduces a UNITCHECK
block type to solve exactly this problem; we can't change the interpreter :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Catalyst::Plugin::DBIC::QueryLog

2007-09-03 Thread Matt S Trout
On Sat, Sep 01, 2007 at 04:08:09AM +, Fayland Lam wrote:
 hi, guys.
 
 since I can't touch Cory Watson by [EMAIL PROTECTED] mailto:[EMAIL 
 PROTECTED]
 so I wonder if this module is fine?

No, it's awful. There's no reason at all for this to be a plugin.

I'd suggest you make it a mixin for Catalyst::Model::DBIC::Schema instead.

(otherwise how do you deal with two DBIC models each with their own
querylog etc. etc.)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] user maintenance

2007-09-03 Thread Matt S Trout
On Fri, Aug 31, 2007 at 03:05:46PM -0700, 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.

in MyApp::Schema::User -

sub insert {
  my $self = shift;
  my $ret = $self-next::method(@_);
  $self-add_to_roles(
$self-result_source-schema-resultset('Role')
 -find({ name = 'User' })
  );
  $ret;
}

(assuming you have a 'roles' many-many set up)

The delete should happen automatically.

For more questions, please ask the DBIx::Class list - Catalyst doesn't really
need to get involved with this logic at all.

 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.)
 
 Is there some recommended way? What do other folks do? 
 
 Cheers,
 
 -- 
  |\  /||   |  ~ ~  
  | \/ ||---|  `|` ?
  ||ichael  |   |iggins\^ /
  michael.higgins[at]evolone[dot]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/

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Catalyst and Informix

2007-09-03 Thread Matt S Trout
On Tue, Sep 04, 2007 at 10:45:24AM +1200, Robert Carew wrote:
 Hi
 
 I am trying to use Catalyst with an Informix database and am having
 problems with DBIC and the use of serial auto-increment keys. After a
 weekend of googling I realise that DBIC does not actually support
 Informix although select and update work ok.

Nobody's filed a bug against DBIx::Class saying there are any problems
with Informix, so we were assuming it worked fine.

Maybe you could get on the dbix-class list and tell us what problems you're
seeing so we can try and help? DBIC supports anything with a user capable
of and willing to send error messages and try DBI tests.

(I have no idea how to use RDBO, though Catalyst::Controller::Rose may help
you there)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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

2007-08-25 Thread Matt S Trout
On Sat, Aug 25, 2007 at 12:41:11AM +0900, Matt Rosin wrote:
 Catalyst::Plugin::I18N::DBIC (and Mango::Catalyst::Plugin::I18N) is
 maybe a crosscutting thing like Zbigniew mentions with some useful
 concepts.
 
 I'm not looking to build Drupal or a blog platform but I have nothing
 against them per se. I was thinking more of a tool to reduce the
 amount of Catalyst code I type by identifying patterns.
 
 For example:
 - A multiuser pattern in which a site is separated into public, admin
 and registered user portals (of which the latter two need to edit lots
 of pesky data like their profiles, their virtual holdings like
 coupons/listings/catalogs/resumes/banners//video clips, etc.).
 Currently I would do this with a formbuilder form, view and save subs,
 and TT template for each page.

Reaction's action reflector plus the ActionForm viewport

 - Another pattern might be to get one or a list of objects a user
 owns, make a list of them and create an interface allowing them to
 edit and save the data. We all keep reinventing the wheel with this.

Reaction's action reflector plus the ListView, ActionForm and CRUDController
classes.

 Currently I would look at similar subs I'd made and well reinvent the wheel...
 
 I have 3 ideas at the moment.
 
 1a. A standard object editor with rich editor and maybe some widgets.
 It would render a complex form as necessary, given the object to be
 edited. I once wrote something like this that would just let you edit
 object data fields with text input boxes, it's not rocket science.

Done.

 1b. Online asset manager to CRUD them, with a file upload widget might
 also be nice.

Mostly done.

 2a. Reduce the set of all information assets a user owns into a single
 tree that may span many tables, allowing each asset (object, data
 field, etc.) to be called from templates by name (could use namespaces
 and dot notation maybe). This is probably most useful in the context
 of having a tree of all text snippets, etc. used in display of the
 public site.

Doable using metaprotocol introspection. Right now you need to feed Moose the
info by hand but in DBIC 09 it'll be baked in.

 2b. This reduces templates to a list of assets (snippets) called by
 name interspersed with HTML tags and TT directives. Text snippets
 would reside in a database and could be edited in a CMS, at least like
 the utility of 1a/b above. Image pathnames or a single DIV's HTML
 could also all be stored in the db. The template would just pull the
 snippets out with a simple $c method like loc in the above I18N
 modules. A standard facility for editing these things (a module and TT
 templates) would also be useful.

I'm mostly just using the i18n plugin plus a tree of files under svn for this
but our designer learned svk shortly after wiping windows in favour of ubuntu
in a fit of anger with it during LugRadio Live.

 3. Beyond this, I see an awful lot of programming and design going
 into solving similar basic interface problems over and over. It would
 be useful to provide some basic TT layouts and scripted user
 interactions (I don't mean write perl script, I mean just write the
 basic plot, preferably as an interpreted string of text but even yaml
 could be used).

Agreed. The new reaction widget model works towards the latout part, I was
planning to hook Class::Workflow to handle the scripty bit.

  Currently we sometimes reuse templates (for example I
 have a general modal dialog), but we don't really have smart systems
 that DWIM the user interaction for basic data editing. For one thing,
 we all look at each other's public sites but not the admin or user
 portal pages which could require more programming work. Contributing
 to solving repeated patterns once well will make Catalyst even more
 powerful I think. A repository of such interface snippets (combination
 of TT code, perl code, etc.) could be run on the dev site maybe.  At
 the risk of sounding like I'm all talk I'm willing to provide my
 current admin and customer portals to the project, possibly the TT
 templates would be useful. Anyway they do look a little like the
 Catalyst startup page. :)

I'd love to see the code publically, even if it isn't re-used it's instructive
to see how other people do it.

In the same spirit: http://trout.me.uk/scsite.tgz is the Shadowcat website
code base running on svn reaction from http://code2.0beta.co.uk/reaction/svn
and I intend to artistic license the site codebase (not sure what we'll do
about the content and layout yet, but I don't imagine our website copy
is of great re-use value to anybody else anyway :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
List: Catalyst@lists.rawmode.org
Listinfo

Re: [Catalyst] Problem with Catalyst::View::HTML::Template + config file

2007-08-25 Thread Matt S Trout
On Sat, Aug 25, 2007 at 12:11:06PM -0400, Luis E. Muñoz wrote:
 Hi Folks
 
 I've been trying to use a configuration file to set parameters in the  
 HTML::Template view of my Catalyst app, to no avail. (Specifically,  
 setting die_on_bad_params = 0).
 
 No matter what I put in the config file, this does not work. This is  
 an approximation to my app:

 ...

 So, what am I doing wrong? What's missing?

I (hopefully) fixed this for you in svn at the time and asked you to test it.

The only response I got was something about upgrading Catalyst-Runtime and
that not fixing it, which of course it didn't since that's not the buggy thing.

What you need to be testing it the svn version from:

http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-View-HTML-Template

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] DBIx question

2007-08-25 Thread Matt S Trout
On Fri, Aug 24, 2007 at 07:57:50AM -0700, Will Smith wrote:
 Hi, I know this is not the room for DBIx, I tried to post in DBIx, but did 
 not go through, so, if you don't mind, please do not bounce me out.

Then you need to try and subscribe again, and if that doesn't work you
mail the list administrator, which incidentally is me.

You're a programmer for a living. You can figure out how to work a mailing
list.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Should CATALYST_DEBUG suppress manual calls to $c-log-debug()?

2007-08-25 Thread Matt S Trout
On Fri, Aug 24, 2007 at 10:15:37PM +0100, Will Hawes wrote:
 I've been trying unsuccessfully to disable all debug messages while running
 tests on my app with prove. Setting CATALYST_DEBUG=0 eliminates all the test
 server debug output such as the list of loaded actions, but i am still
 seeing the output of every call made to $c-log-debug by my controller
 code.
 
 As far as I can see the docs regarding CATALYST_DEBUG=0 don't make any
 distinction about where debug messages originate, only that they are
 suppressed, which presumably means I shouldn't be seeing any debug output at
 all.
 
 Is my mistake in misunderstanding how $c-log-debug() is supposed to work?

Yes.

That logs a message of level 'debug'.

The internal Catalyst debugging aid stuff checks $c-debug and if so logs
messages with the debug level. But that doesn't mean turning off the internal
debugging changes the configuration of your logger whatsoever.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] XML RPC Server and RenderView

2007-08-25 Thread Matt S Trout
On Fri, Aug 24, 2007 at 07:04:32PM +0200, Nicolas Raspail wrote:
 From Joe Landman (Sun, 22 Jul 2007)
 
 Hi folks:
 
 Using XMLRPC for some service method calls to make life 
 easier/cleaner for some of our code. I am doing something wrong, as 
 I get errors (at the end).
 
   I set up a simple application using the usual methods
 
 catalyst.pl RDB
 cd RDB
 script/rdb_create.pl controller Job
 
 I then set about to use portions of the examples in the 
 Catalyst::Plugin::Server::XMLRPC . Specifically I created a ping and 
 echo method, to test. I placed these in the Job.pm (rather than 
 Root.pm ... is this an issue?). This is what they look like.
 
 
 sub echo : XMLRPC { # available as: job.echo
 my ( $self, $c, @args ) = @_;
 $c-stash-{xmlrpc} = join ', ', @args;
 $c-log-debug($args[0]);
 }
 
 sub ping : XMLRPCPath('/job/ping') {# available as: ping
 my ( $self, $c ) = @_;
 $c-stash-{xmlrpc} = 'Pong';
 }
 
 Ok.  Light up the server, comes up fine:
 
 [EMAIL PROTECTED]:~/remote_db_access/RDB$ script/rdb_server.pl
 [debug] Debug messages enabled
 [debug] Loaded plugins:
 ..
 | Catalyst::Plugin::ConfigLoader 0.14 | | Catalyst::Plugin::Server 
 0.24 | | Catalyst::Plugin::Server::XMLRPC | | 
 Catalyst::Plugin::Static::Simple 0.17 |
 ''
 
 ...
 
 [debug] Loaded Private actions:
 .--+--+--.
 | Private | Class | Method |
 +--+--+--+
 | /end | RDB::Controller::Root | end | | /job/ping | 
 RDB::Controller::Job | ping | | /job/echo | RDB::Controller::Job | 
 echo |
 '--+--+--'
 ...
 [debug] Loaded XMLRPCPath Method actions:
 .--+---.
 | XMLRPCPath Method | Private |
 +--+---+
 | job.echo | /job/echo | | job.ping | /job/ping |
 '--+---'
 
 
 Now try the echo call:
 
 [EMAIL PROTECTED]:~$ rpc_client -u http://localhost:3000/rpc -m 
 /job/echo \
abcd 123
 
 I get this on the client side:
 
 -Output---
 $VAR1 = {
   'faultString' = 'Internal Server Error',
   'faultCode' = '500'
 };
 
 
 And I get this on the server side:
 
 [info] RDB powered by Catalyst 5.7007
 You can connect to your server at http://balto:3000
 [info] *** Request 1 (0.011/s) [10821] [Sun Jul 22 23:05:27 2007] ***
 [debug] POST request for rpc from 127.0.0.1
 [debug] XML-RPC: Method called: /job/echo
 [debug] Path is job/echo
 [debug] abcd
 [debug] XMLRPC 500 Errors:
 Caught exception in RDB::Controller::Root-end 
 Catalyst::Action::RenderView could not find a view to forward to.
 [info] Request took 0.134054s (7.460/s)
 .+---.
 | Action | Time |
 ++---+
 | /job/echo | 0.000191s | | /end | 0.001559s |
 '+---
 
 Basically it is telling me that it doesn't have a view to forward to. 
 Is this needed in Server::XMLRPC ? I thought it did html encapsulated 
 XML ... no view needed.
 
 Any thoughts/clues?  Thanks.
 
 Joe
 
 Hello,
 
 when playing with Catalyst::Plugin::Server::XMLRPC following the 
 documentation, I get the same behaviour as Joe.
 
 I have search the archive and found thie mail from Joe Landman , and he 
 has the same problem, but unfortunately, nobody answer him.
 
 I have copy/paste his email because his setup and mine are the same, and 
 I don't have my script available right now.
 
 To get my app running, at the end of my RPC function, I must put an 
 $c-output(' ').
 
 I would like to know if it is the correct thing to do, or I'm doing 
 something wrong.

I'd do -

sub end :Private {
  my ($self, $c) = @_;
  $c-forward('render') unless $c-req-xmlrpc-is_xmlrpc_request;
}

sub render :ActionClass('RenderView') { }

Seems a bit cleaner than your approach.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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

Re: [Catalyst] How do I run finalize_error only if $c-debug is false?

2007-08-22 Thread Matt S Trout
On Tue, Aug 21, 2007 at 09:49:37PM -0400, Barry Hoggard wrote:
 I would like the regular error page with info when I'm running under
 debug.  I have a finalize_error method set up similar to the one from
 the mailing list archives, but I don't understand yet the magic of
 return vs. next() and what will happen if I want to skip my version
 under debug.

my $c = shift;

if ($c-debug) {
  return $c-NEXT::finalize_error(@_);
}

rest of your custom finalize_error here

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] RFC: Multiple :Chained and/or :PathPart attributes?

2007-08-20 Thread Matt S Trout
 that could do this,
  but this is my  
  first trip into the innards of the dispatcher, and
  it looks like it's  
  going to take a while to wrap my brain around it, so
  if anyone has  
  suggestions on how to implement this (or reasons
  that it's a very bad  
  idea) I'd love to hear them...
 
 I don't have any thoughts on this particular idea, but
 I solved a similar solution by creating a common
 action class to handle the action stuff that was
 similar across a few of my controllers.

Well, I'd make all but 'revision' 302 redirects since you should only have
one canonical URI per resource.

More importantly, I'd use a controller base class to provide the view action,
then I'd just need one handler action method to load the target per controller
and all the duplication would be removed.

Trying to handle multiple :Chained attrs on a single action would get messy
fast - I'd love to see it available but I don't see an elegant way to do it
and still leave uri_for_action working correctly, and the controller base
class approach seems to work fine for eliminating duplication.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] improving usability / doc

2007-08-17 Thread Matt S Trout
On Thu, Aug 16, 2007 at 05:06:10PM +0200, Adam Bartosik wrote:
 I wonder how much better Catalyst doc would looks if the top doc page, 
 http://search.cpan.org/dist/Catalyst-Manual/ (linked from top catalyst page)
 had tutos in 1..9 order, not alphabetical?
 
 Is such change in naming eg:
 Catalyst::Manual::Tutorial::1_Intro
 Catalyst::Manual::Tutorial::2_CatalystBasics
 possible?

That would be ugly.

Can you find anywhere that page is linked to and tell us so we can make it
link to

http://search.cpan.org/perldoc?Catalyst::Manual::Tutorial

instead, since that already shows them in the right order.
 
 There is also an open ticket for - maybe - this kind of work
 http://dev.catalyst.perl.org/ticket/82

The trac ticket system is dead and turned off, please ignore it.

 I just think how can I help in this process of improving documentation 
 for my favorite framework. I am a perl programmer with strong experience 
 of initiating new sites, promoting, advertising - nothing special but 
 could be helpful to improve cata site.
 
 Take a look at doc pages of rails:
 http://rubyonrails.org/docs
 django:
 http://www.djangoproject.com/documentation/
 or even not so popular mvc like Pylons
 http://wiki.pylonshq.com/display/pylonsdocs/Home
 
 How many people decided to take different framework just because 
 catalyst doc still sucks?

Funny, several of the people who've come to Catalyst from rails said one
of the reasons they moved was because the rails doc  sucks.

Mostly what you're complaining about is presentation though and where things
are referenced from. If you send a message to catalyst-dev@ asking for it
one of the wiki gnomes will give you access to that and you can re-arrange
the order stuff's displayed in to your heart's content.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] t directory hierarchy

2007-08-15 Thread Matt S Trout
On Wed, Aug 15, 2007 at 11:27:14AM +0100, Ian Docherty wrote:
 Hi
 I have been using Catalyst for some time with a 'flat' test directory, 
 with all test scripts in the same directory.
 
 The main reason for this is that when I do
 
 $ make test
 
 It does not recurse into the sub-directories and only runs test scripts 
 in the 't' directory.

That's the default behaviour. To add subdirs, put

tests('t/*.t t/*/*.t');

in your Makefile.PL

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Serving server-dependent static content

2007-08-13 Thread Matt S Trout
On Sun, Aug 12, 2007 at 03:49:40PM -0400, Andy Grundman wrote:
 
 On Aug 12, 2007, at 2:22 PM, Peter Lytle wrote:
 
 Good afternoon - I am working on a Catalyst application that serves  
 dynamic website content for multiple sites, and I've run into some  
 difficulty about static content.  Each website has unique static  
 content (images, css, rss) and I am trying to serve that static  
 content from the site's unique directory.  I have found lots of  
 documentation on how to serve all static content from a single  
 directory, but not much on a servername-dependent directory.  For  
 example:
 
 Request:  http://www.timjohnson.com/css/global.css
 Should be served with:  /var/www/html/sites/timjohnson.com/css/ 
 global.css
 
 I came close to making this happen just using the Alias directive  
 in httpd.conf, but I couldn't get that to accept a variable, % 
 {SERVER_NAME}, in it.  If someone has a solution from the Apache  
 side, that's fine but I suspect that it might be easier to do this  
 with Catalyst::Plugin::Static::Simple, though I again have not  
 figured out how to tell it to use a variable name when it creates  
 the path the request is supposed to be mapped to.  I am sending  
 this to the Catalyst list because I suspect it might be something  
 other people have faced before using Catalyst.
 
 My setup is a recent version of Catalyst running on Apache 2.2 with  
 mod_perl.  Any suggestions would be quite welcome - thank you very  
 much.
 
 As has already been said, you should use Apache for this.  But if you  
 *really* want to use Static::Simple, take a look at the docs for the  
 Including additional directories, and in particular the  
 incpath_generator sample code.  You can write a bit of code that  
 returns one or more directories from which to serve static content.

Did we make _serve_static_file public yet? Having a way to do something
like that dynamically is the one thing I still -really- miss from the old
Static plugin.

... alternatively, we could always have Controller::Static blah blah plugins
evil blah yadda no really this time a plugin's fine :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Often used templates as method

2007-08-13 Thread Matt S Trout
On Mon, Aug 13, 2007 at 01:50:54PM +0200, Sven Eppler wrote:
 Hello!
 
 I'm using catalyst with TT as my template engine. I made some templates  
 for errors, warnings, messages, redirecting and stuff. But because i'm a  
 quite a lazy boy i don't like to do this:
 
 
 $c-stash-{title} = Some Error Title;
 $c-stash-{message} = Some error message;
 $c-stash-{template} = 'box/error';
 
 
 over and over again. Beside my lazyness, this would even help me out if i  
 deicide to rename the template sometime or stuff like this. So i thought  
 about a better way. Which eventually should be a method which resides in  
 the View itself. Something like:

Why not just wrap these up into a controller method?

$c-forward('/setup_error', [ $title, $message ]);

or whatever?

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Method to overload per request

2007-08-10 Thread Matt S Trout
On Thu, Aug 09, 2007 at 02:28:52PM -0400, John Lifsey - Contractor - wrote:
 
 Dylan Vanderhoof wrote:
 
 
 Is there a method in C::Req (or any other part of Cat) that I can 
 overload which is called only once per request? I thought 
 that would be 
 prepare, but it seems that is called several times per page load. Any 
 advice appreciated.
 
 John
 
 
 MyApp::Controller::Root-auto?
 
 -Dylan
 
 That would be fine on a per controller basis, but this is in a plugin 
 and should apply for any request to any controller.

prepare should normally only be called once per request cycle.

If you aren't trying to interrupt the request cycle, it shouldn't be a
plugin.

I suggest you should start a new thread explaining what you're actually
trying to achieve; my current thought is 95% probability your design is
wrong, based on previous experience of clients saying the same things to me.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Catalyst Hosting

2007-08-09 Thread Matt S Trout
On Thu, Aug 09, 2007 at 11:36:45AM +0900, Matt Rosin wrote:
 Hello,
 
 I remember somewhere catalyst-friendly hosting. I'm looking for a new
 hosting company. I don't relish using catalyst without root access,
 having built it once locally, especially since I don't want to have to
 ask the company every time to edit the apache config for me.

We're (eventually) intending to offer Catalyst-optimised shared hosting.

The reason we don't already is because we haven't yet got our experiments
to a point where we think there's a substantial value-add over getting a
dreamhost acct and upgrading to $vps/whatever if you outgrow that, plus
getting a support contract off us if you want to be able to ask for help
with config/beating CPAN into submission/whatever else (I don't normally
make a major point of us offering those but it's necessary context to what
is for the moment fundamentally a recommendation of dreamhost :).

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Catalyst Unicode woes ...

2007-08-09 Thread Matt S Trout
On Thu, Aug 09, 2007 at 02:56:31PM +0200, Tobias Kremer wrote:
 Zitat von Tatsuhiko Miyagawa [EMAIL PROTECTED]:
  Similarly even if your templates are encoded in utf-8,
  Template-Toolkit doesn't know which encoding they are in, until you
  set BOM to your templates or use Template::Provider::Encoding to
  explicitly specify the encoding to decode the template.
 
 I just found the (undocumented?) ENCODING configuration option in
 Template::Provider. Setting this to utf-8 makes the templates appear
 correctly with C::P::Unicode loaded. Is there still a need for
 Template::Provider::Encoding?

Ooh. doc patch to View::TT ?

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Catalyst Unicode woes ...

2007-08-09 Thread Matt S Trout
On Thu, Aug 09, 2007 at 04:42:53PM +0200, Tobias Kremer wrote:
  View::TT
  ENCODING: UTF-8
 
  Template provider will see you are running a modern Perl (UNICODE flag
  in provider) and then look for a Byte Order Mark.  If not found it
  will then decode your content based on the ENCODING setting.
 
  No, you don't need Template::Provider::Encoding if you only have one
  encoding in your templates.
 
  Yes you need Unicode (or the older Unicode::Encoding) plugin so that
  input params are decoded and output is encoded back to utf8.
 
 Yes, it all starts to make sense :) Thanks for all the great clarifications.
 MyApp is working fine now with C::P::Unicode and the ENCODING setting. By the
 way, does anybody know why the ENCODING option is undocumented? IMHO, it 
 really
 should be mentioned in the Catalyst::Manual alongside some best-practice for
 Unicode. Use C::P::Unicode and ENCODING: UTF-8 should be enough for most 
 people
 ...

Because (1) we don't control the TT docs, (2) you haven't written the doc
patch for the Catalyst docs yet. I agree that you should patch the main manual
as well as View::TT docs though :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Multi Mod_Perl apps

2007-08-08 Thread Matt S Trout
On Wed, Aug 08, 2007 at 06:14:54AM -0700, Will Smith wrote:
 Hi,
  Sorry if I post an old question, I just want to know if I could do this to 
 run multi app on the same server under mod_perl:

Write a startup.pl that does 'use lib' and PerlModule directives
appropriately.

Also, if you're attempting to build a live deployment platform consider
getting a professional in to set it up, there's quite a few of us about and
it's better to spend a few hundred dollars on a consultant than have your
production platform go down because management expected you to be a sysadmin
as well as a developer.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] output to tt2 and pdf

2007-08-08 Thread Matt S Trout
On Wed, Aug 08, 2007 at 04:01:25PM +0200, Ulf Lenski wrote:
 Hi,
 on http://www.catalystframework.org i found:
 And in case you want PNG or PDF output, you'll need just a few lines...
 where can I find an example for the PDF output?
 
 What I need:
 The HTML-ouput in 1:1 as pdf-download on the same page!
 
 Example:
 
 I create a list of names in the controller bla and bring this list to a
 web-page via TT:

http://search.cpan.org/~andrewf/Template-Latex-2.17/lib/Template/Plugin/Latex.pm

TT can make PDFs too.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Canonical address changes from rawmode.org - scsys.co.uk

2007-08-08 Thread Matt S Trout
I'm sick of having to interrupt gabb in .cz every time the list server moves
IP so I'm centralising stuff under an SC domain.

The lists.scsys.co.uk URLs and mail acceptors -should- already work and I'm
not going to turn lists.rawmode.org off just yet but people seem to have
missed the announce on the DBIC list and keep complaining their sieve
configs don't work, so can you all get this done -now- and I'll cut it over
later please :)

Also, somebody get the cat docs changed and a new manual release ready.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] overload/override sub? (Session::PerUser)

2007-08-07 Thread Matt S Trout
On Mon, Aug 06, 2007 at 09:42:28PM +0100, Ash Berlin wrote:
 Fernan Aguero wrote:
  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
 
 Redefine is the term in perl-lingua.

Not really, it's just subclassing. 

Catalyst plugins (like DBIC components) just end up as extra superclasses
 
 In MyApp.pm:
 
 {
   no warnings 'redefine';

# this line is completely pointless.

 
   sub merge_session_to_user {
 # your new sub
 
 # ...
 
 # To call the previous implementation if you should want it:
 # $self-NEXT::merge_session_to_user(@args);
   }
 }
 
 The key thing to remember here is that all Cat plugins 'pollute' the $c
 namespace, which isa Myapp.

They end up on your @ISA, this polluting the namespace of potential method
names, but they don't pollute the MyApp package directly - that level of
stupidity I haven't seen since Class::DBI::Plugin::*

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] TT macro to avoid excessive $c-uri_for calls

2007-08-07 Thread Matt S Trout
On Tue, Aug 07, 2007 at 09:43:30AM +0200, Tobias Kremer wrote:
 I'm wondering if it has any bad side effects to have a TT macro which is set 
 to
 $c-uri_for. If I'm remembering previous posts on this topic correctly, 
 calling
 uri_for() repeatedly has quite a big impact on performance which really 
 matters
 most for my current application. I have this in a global macros.tt2 file:

That's why we optimised the living crap out of uri_for.

It's more than 10x faster than it used to be.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Reseting a chained action

2007-08-07 Thread Matt S Trout
On Tue, Aug 07, 2007 at 10:13:59AM +0100, Pedro Melo wrote:
 Hi,
 
 In the course of a project I'm working on, I found it useful to  
 reset chained actions. It would work like this:
 
   . assume that you have a chain like /company/ID/copywrongs
   . and in certain situations you want a alternative environment for  
 the chain, like this:
   /approve/company/ID/copywrongs
 
 The /approve would modify the stash to include some alternative  
 schema or environment that the rest of the chain could use to tweak  
 their behavior. The thing is, the /approve action would like to tell  
 catalyst ei, please disregard me and start over.

Wouldn't it be simpler to have two parallel chains via subclassing, one
set chained off '/' and one off the 'approve' action?

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] How to execute controller at startup

2007-08-07 Thread Matt S Trout
On Mon, Aug 06, 2007 at 11:33:04PM -0700, Aditya Verma wrote:
 Hi All,
 
 Thank you very much for all your valuable comments at appreciate your quick
 response.
 
 I have one more query.
 I have implemented a Plugin. How can I call a plugin method from controller
 outside of the controller methods.

You shouldn't.

If you need to do that, the method shouldn't be in a plugin.

Don't hack up your Catalyst app, fix your design :)

 suppose i have a Plugin named Catalyst::Plugin::MyPlugin contains a method
 called sub myFunc {}

That should be my_func, not myFunc. This is perl, not java. Please stick to
the correct naming conventions for things.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] TT macro to avoid excessive $c-uri_for calls

2007-08-07 Thread Matt S Trout
On Tue, Aug 07, 2007 at 01:10:09PM +, Zbigniew Lukasiak wrote:
 On 8/7/07, Matt S Trout [EMAIL PROTECTED] wrote:
  That's why we optimised the living crap out of uri_for.
 
  It's more than 10x faster than it used to be.
 
 Great to hear that.  Does it also apply to uri_with?

Nobody ever reported that as a bottleneck, and it's a much simpler code
path already.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Ajax

2007-08-05 Thread Matt S Trout
On Sat, Aug 04, 2007 at 10:44:30PM -0400, Javier E. Perez P. wrote:
 El vie, 03-08-2007 a las 10:47 +0300, Octavian Rasnita escribió:
  Hi,
  
  Which of the Ajax modules do you recommend using in a Catalyst app?
  I am interested especially to know which of them work better with 
  Template-Toolkit and DBIx::Class.
  
 
 I particularly use jQuery, the way that i pass the data from the
 controller to the view is like this
 
 my $obj = [ map { { id = $_-id,  name = $_-name} }
 $c-model('tegzDB::Author')-search({ name = { like = '%javier
 %' } }) ] ;
 
 $c-res-body(objToJson($opciones));

Always, -always- use View::JSON rather than doing the serialisation direct.

Otherwise you're writing an 'MC' system not 'MVC' and claco'll start making
hammer time jokes again.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] accessing methods in another controller?

2007-08-05 Thread Matt S Trout
On Sun, Aug 05, 2007 at 10:59:50AM -0400, Alan Spector wrote:
 Hi all,
 
 I had a quick question, what is the best way within a Controller to  
 access  a method in another controller?  or is it better to put the  
 method (it's a fetch for data in a particular format) in my Model?

What ash said, but I'd probably push it into the model anyway.

Generally the controller should be application control flow logic and
very little else.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Catalyst and IPC::Open2

2007-08-04 Thread Matt S Trout
On Sat, Aug 04, 2007 at 04:24:09PM +0200, Markus Holli Holzer wrote:
 Hi.
 I'm Holli (known as holli at Perlmonks).
 This message is a duplicate of a posting there( 
 http://www.perlmonks.org/index.pl?node_id=630220 ).
 As nobody seems to be able to help me, I seek the wisdom of this lists' 
 users:

STDOUT and STDERR probably aren't what it expects.

Try doing the same save+restore trick I use here -

http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Controller-WrapCGI/lib/Catalyst/Controller/WrapCGI.pm

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Test server as a child process

2007-08-01 Thread Matt S Trout
On Tue, Jul 31, 2007 at 12:33:52PM +0400, Ivan Fomichev wrote:
 Hello,
 
 I intend to write a script, that would start the test server as a
 child process and then run tests.

Why not just use Test::WWW::Mechanize::Catalyst which embeds a server instance
in the test script?

Using the test server instead is really just testing Catalyst::Engine as
well as your code, and we already have a test suite.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] do I need to load Apache::DBI?

2007-07-31 Thread Matt S Trout
On Mon, Jul 30, 2007 at 06:19:09PM -0400, Perrin Harkins wrote:
 On 7/30/07, Matt S Trout [EMAIL PROTECTED] wrote:
  I used to consider it a neat hack. After some time with the internals,
  some fun explicitly disabling it within DBIC since it sometimes broke our
  reconnect code, and even then discovering I could often solve client 
  mod_perl
  problems by removing the line that loaded it from httpd.conf, I reclassified
  it was 'awful'.
 
 Your implication is that Apache::DBI doesn't work, as opposed to
 simply clashing with some of the DBIC code that tries to manage the
 same connections.  It works just fine.  It's widely-used and does what
 it was intended to without known bugs.

Except in the DBIx::Class, Class::DBI and plain DBI apps I've brought back
to production quality stability by removing it.

There's no implication - sometimes it doesn't work. Mostly it does. Producing
a repeatable test case has proven pretty much impossible due to the hackiness
of the implementation. Since I usually -can- modify the calling code I
just switch it over to using a DBIC storage object to manage the $dbh and
move on.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Re: Running MyAppB under MyAppA (only for developers)

2007-07-31 Thread Matt S Trout
On Tue, Jul 31, 2007 at 07:23:20PM +0400, Oleg Pronin wrote:
 Thanks for a lot of usefull answers :)

I went through this with you at some length in a different thread, and don't
have anything else to add.

I guess most other people don't either.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] perl survey 2007

2007-07-29 Thread Matt S Trout
http://perlsurvey.org/

Go. Take the survey. The FAQ explains why.

I could provide a long explanation but the site has a perfectly good one
already :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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 Workflow with Catalyst (was Making Controllers thin and Models thick)

2007-07-29 Thread Matt S Trout
On Sun, Jul 29, 2007 at 03:52:58PM +0200, jonasbn wrote:
 Hello,
 
 I am the current maintainer of the Workflow module on CPAN and I just  
 want to add my 2 cents here, since Matts' comments on Workflow is in  
 my opinion are both unfair and inapproriate and not particularly  
 constructive. I am sure he has more constructive criticism and I  
 would like to discuss this with him the next time we meet, since Matt  
 seems like a sensible guy.

When I wrote Workflow off there hadn't been a release in some time and the
author was available but disinterested so an active maintainer seemed unlikely
to happen and we'd tried and failed to get patches merged.

I'm glad to see that's no longer the case, but it still strikes me as
massively heavy and clumsy for the job it does - anything where the synopsis
has *four* XML files before it even gets to any code screams overengineering
at me.

And of course, Workflow::Factory is a magic global (this week under the guise
of singleton, but it's still a magic global) so I can't rely on its
behaviour in any situation where I'm going to be running more than one app in
the same interpreter.

If I wanted to deal with overengineering -and- magic globals at the same time,
I could learn J2EE. As it is,

FACTORY-add_config_from_file(
  workflow  = 'workflow.xml',
  action= [ 'myactions.xml', 'otheractions.xml' ],
  validator = [ 'validator.xml', 'myvalidators.xml' ],
  condition = 'condition.xml',
  persister = 'persister.xml'
);

does not compare well to

my $wf = Class::Workflow-new;

$wf-state(
  name = new,
  transitions = [qw/accept reject/],
);

$wf-transition(
  name = accept,
  to_state = opened,
  body = sub {
my ( $transition, $instance, $context ) = @_;
return (
  owner = $context-user, # assign to the use who accepted it
);
  },
);

to my mind. Perhaps it would be worth adding a way of setting up a workflow
in code and documenting that first rather than the XML format? (no, being
able to use four perl-syntax files instead of four XML files does -not-
count from my POV :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/ 

___
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] Use Undo on A List Apart

2007-07-28 Thread Matt S Trout
On Sat, Jul 28, 2007 at 01:00:14PM +0200, Matthieu Codron wrote:
 Hi,
 
 Le 26 juil. 07 à 08:55, Bill Moseley a écrit :
 
 There's a recent article titled Never Use a Warning When you Mean
 Undo at http://alistapart.com/articles/neveruseawarning.
 
 I'm wondering about the implementation.
 
 
 I read that too. Interesting, but from what I see undo is not so easy  
 to implement.
 
 One option is to create actions for every possible undo operation.
 That would mean that each undo operation would generate a specific
 link, including request parameters to identify the item that needed to
 be, well, undone.
 
 Another possibility would be to generate the code for the undo action
 and place it in the session so that there's just an /undo link.  /undo
 fetches the code and evals/executes it.  The /undo link would only be
 available for a single request after displaying the undo link.
 
 I like more the idea of a generic undo request. This could be part of  
 a plugin providing this action and the necessary infrastructure to  
 implement the un-doing of the action.

I fail entirely to see why this should be a plugin rather than part of the
model you're intending to make mutations upon undoable.

 This plugin could implement a simple version of the classic Memento  
 pattern (http://en.wikipedia.org/wiki/Memento_pattern)

I'd say DBIx-Class-Audit (currently in bast trunk pending more testing)
already implements this pretty well for DBIC models - except it always saves
the appropriate information, saving you needing to call anything at all to
make the undo happen.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] unconsistency

2007-07-27 Thread Matt S Trout
On Fri, Jul 27, 2007 at 06:12:26PM +0200, jmt wrote:
 While other views (like TT) have always handled UTF-8 correctly, why is 
 XML::LibXSLT and consequently View::XSLT suddenly in the need of some switch 
 I can set for XML::LibXSLT but have no idea of where in Catalyst I can 
 perform the same (spurious) trick ?

I presume you'd want to patch View::XSLT for this, but we're not XML::Lib*
experts - you might be better discussing how to handle that on their lists and
then come back here and work with us to patch in what you learn?

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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 Workflow with Catalyst (was Making Controllers thin and Models thick)

2007-07-26 Thread Matt S Trout
On Tue, Jul 24, 2007 at 07:52:46PM +0100, Ian Docherty wrote:
 Matt
 Thank you for that succinct analysis. :) I will give Class::Workflow a 
 good look in that case.
 
 Do you know how far off Persistence using DBIC is with this? I think it 
 would be essential for the Catalyst application I have in mind.

how far off ?

I know Yuval's implemented it a couple times; you just storable-ify the
workflow object and drop it in a column.

Should be a fairly trivial inflate_column call.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] YAML Config

2007-07-24 Thread Matt S Trout
On Tue, Jul 24, 2007 at 04:45:32PM +0400, Oleg Pronin wrote:
 Hi.
 
 I would like to use references to variables that have been defined in my
 yaml config.
 
 Something like this:
 
 var_dir: var __path_to(var)__
 
 log_dir: log *var/log
 log_file: *log/file.txt

Config::General definitely supports something like that, so maybe throwing
the horror that is YAML out of your app early and moving to .conf would work.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] do I need to load Apache::DBI?

2007-07-24 Thread Matt S Trout
On Tue, Jul 24, 2007 at 09:20:00AM +0200, Cédric Bouvier wrote:
 Hello,
 
 I have failed to understand something. If I run my Catalyst application
 under mod_perl, will it automatically use persistent database
 connections, or do I have to explicitely tell mod_perl to load
 Apache::DBI?

Catalyst has exactly no effect on database connections. It's a web framework.
You might not even be using a database.

DBIx::Class and Catalyst::Model::DBI both maintain persistent connections
themselves though.

Apache::DBI is an awful hack and should be avoided where possible.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] YAML Config

2007-07-24 Thread Matt S Trout
On Tue, Jul 24, 2007 at 10:08:03AM -0400, Adam Herzog wrote:
 On Jul 24, 2007, at 9:43 AM, Dave Howorth wrote:
 Oleg Pronin wrote:
 How to use other variables' values in yaml config?
 
 I always end up implementing $substition (a la shell or perl) in my  
 app.
 
 I've used Config::General with variable interpolation to do this, in  
 the past.
 
 Although Config::General is supported by Config::Any (and therefore  
 by Catalyst::Plugin::ConfigLoader, which I'm assuming we're talking  
 about), there isn't any mechanism to pass configuration to  
 Config::General when it's instantiated, so it doesn't interpolate by  
 default. I ended up creating my own Config::Any::General::Interpolate  
 which loads files called .cnfi or .confi, and tells Config::General  
 to interpolate the variables.
 
 I think it would be better to have a mechanism in Config::Any to pass  
 configuration through to Config::General, but I never bothered to  
 come up with a patch or suggestion on how it should work. I guess  
 maybe I should. I think I've also seen some movement towards removing  
 YAML as the default config type, but maybe I just dreamed that.

.conf becomes the default as of 5.80.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] YAML Config

2007-07-24 Thread Matt S Trout
On Tue, Jul 24, 2007 at 05:56:26PM +0400, Oleg Pronin wrote:
 YAML::Syck  YAML::XS supports them.
 The problem is in aliases.
 At yaml.org specification i found only simple examples like var2: *var1.
 But i
 need to concatenate *var1 with something ($var2 = $var1 . '/subdir').
 This code is a syntax error on all three parsers:
 var2: *var/subdir
 var2: *var /subdir
 etc
 
 I didn't find it in specification.
 YAML::XS is the most advanced Yaml parser supporting Yaml 1.1, but it is not
 used by Catalyst.

If you want it to be, submit patches to Config::Any.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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 Workflow with Catalyst (was Making Controllers thin and Models thick)

2007-07-24 Thread Matt S Trout
On Tue, Jul 24, 2007 at 02:43:12PM +0100, Ian Docherty wrote:
 Thanks for pointing out the workflow CPAN module. I am very interested 
 in this for my current project and must spend some time looking at it.
 
 Has anyone actually used workflow within a Catalyst application and can 
 they give the list their opinion and experiences with it?

It's an awful horrible piece of shit. Class::Workflow was written by
our very own Yuvla Kogman to replace it and works very nicely with Catalyst.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] YAML Config

2007-07-24 Thread Matt S Trout
On Wed, Jul 25, 2007 at 12:11:24AM +0400, Oleg Pronin wrote:
 I ended up with using Config::Any::Perl:
 in /myapp.perl
 
 package MyApp::ConfigurationSet;
 
 $home = Path::Class::Dir-new(MyApp-config-{home});
 ...
 $var_dir = $home-subdir('var');
 $pid_dir = $var_dir-subdir('pid');
 $log_dir = $var_dir-subdir('log');
 $log_file = $log_dir-file('default.log');
 ..
 return +{
map { $_ = ${RGames::ConfigurationSet::$_} }
grep { $_ !~ /^BEGIN$/ }
keys %{MyApp::ConfigurationSet::}
 };
 
 :

That's both utterly evil and extremely neat.

Nice hack.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] Trimming and Quoting Oh My!

2007-07-24 Thread Matt S Trout
On Tue, Jul 24, 2007 at 11:16:54PM +0100, Chisel Wright wrote:
 Just a polite request. Would it be possible for:
 
 
   The first rule of ultra-violet pen club is no-one discusses ultra-violet
+pen club.
   The second rule is always replace the cap.

3. People with plain text sigs with hard returns to keep the damn things
to 78 chars

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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

2007-07-23 Thread Matt S Trout
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.

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.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] Re: [RHTMLO] RDBO/RHTMLO integration with Catalyst - work in progress

2007-07-22 Thread Matt S Trout
On Sat, Jul 21, 2007 at 08:02:24AM -0500, Peter Karman wrote:
 check out Catalyst::Controller::Rose on cpan.
 
 It has a different philosophy than what you've described. But if you find 
 features missing that you think would make it more useful, please send me 
 patches/tests/docs etc. You might consider writing a new 
 Catalyst::Controller::Rose::SomeThing to implement what you're describing 
 with YAML.

Do you have any plans to split the dependencies a bit on this?

I've always been quite fond of RHTMLO and have been on a couple projects now
where we considered Controller::Rose and had to pass on it because it
assumed you wanted RDBO as well.

Catalyst stuff should really be as non-opinionated as possible - people might
want to use RDBO with a different form library too, and it'd be nice for the
glue to elegantly support that case as well.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] PATCH: refactor Catalyst::Engine::HTTP::Restarter to standalone module

2007-07-22 Thread Matt S Trout
On Sun, Jul 22, 2007 at 08:58:42AM -0400, Mark Stosberg wrote:
 Hello, 
 
 I like the auto-restart feature that is in the Catalyst HTTP::Restarter
 server. I wanted to use the restarting trick with a project based on
 HTTP::Server::Simple, so I looked to see how tied this functionality was to
 Catalyst. Here's what I found:
 
 Catalyst::Engine::HTTP::Restarter::Watcher is not functionally tied to
 Catalyst at all. It just shares a namespace. 
 
 Catalyst::Engine::HTTP::Restarter depends on no functionality from Catalyst
 but was still coupled with it through a base-class relationship which could
 be easily avoided.
 
 The attached patch moves these to modules into the HTTP::Server::Restarter
 namespace, and makes slight alternations to the other Catalyst files so
 that the functionality remains the same, as well as the dependencies. 

Wouldn't Devel::Restart::Automatic or similar be more sensible name-wise?

I don't see that there needs to be anything HTTP-dependent in the code
you're factoring out.

Once we've settled one a name, I'd be happy to set up a directory under
Catalyst svn for the factored out code and give you commit to it, then we
can move the core across to it once everybody's had a chance to play with
the factored-out code and stabilise it.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] PATCH: refactor Catalyst::Engine::HTTP::Restarter to standalone module

2007-07-22 Thread Matt S Trout
And can we move this to the -dev list where it belongs, please?

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] Re: PATCH: refactor Catalyst::Engine::HTTP::Restarter to standalone module

2007-07-22 Thread Matt S Trout
On Sun, Jul 22, 2007 at 04:30:48PM -0400, Mark Stosberg wrote:
 Matt S Trout wrote:
 
  On Sun, Jul 22, 2007 at 08:58:42AM -0400, Mark Stosberg wrote:
  Hello,
  
  I like the auto-restart feature that is in the Catalyst HTTP::Restarter
  server. I wanted to use the restarting trick with a project based on
  HTTP::Server::Simple, so I looked to see how tied this functionality was
  to Catalyst. Here's what I found:
  
  Catalyst::Engine::HTTP::Restarter::Watcher is not functionally tied to
  Catalyst at all. It just shares a namespace.
  
  Catalyst::Engine::HTTP::Restarter depends on no functionality from
  Catalyst but was still coupled with it through a base-class relationship
  which could be easily avoided.
  
  The attached patch moves these to modules into the
  HTTP::Server::Restarter namespace, and makes slight alternations to the
  other Catalyst files so that the functionality remains the same, as well
  as the dependencies.
  
  Wouldn't Devel::Restart::Automatic or similar be more sensible name-wise?
  
  I don't see that there needs to be anything HTTP-dependent in the code
  you're factoring out.
 
 The approach is HTTP specific. The monitor acts as HTTP client and sends a
 special RESTART requeest over HTTP when a change is detected. I looked at
 two different approaches today that involved sending a SIGHUP signal
 instead, and I couldn't get either to work. I suspect the authors settled
 on this approach because it was reliable by comparison.

I suspect SIGUSR1 would work just fine; the 'authors' (mostly Sebastian)
don't actually understand signal handling, I had to do quite a lot of cleanup
work to make the child-related stuff sane.
 
 So, I think HTTP::Server::Restarter is good that part. The second
 module, Watcher.pm is not HTTP-specific, it just monitors a directory for
 changes, based some options.  It is similar to: File::Monitor. 
 
 http://search.cpan.org/~andya/File-Monitor-v0.0.5/
 
 I suggest it be named File::Monitor::Simple

Is there any reason not to switch to File::Monitor while we're here?

  Once we've settled one a name, I'd be happy to set up a directory under
  Catalyst svn for the factored out code and give you commit to it, then we
  can move the core across to it once everybody's had a chance to play with
  the factored-out code and stabilise it.
 
 Great.
 
  And can we move this to the -dev list where it belongs, please? 
 
 I did try that first. Sending the message directly there was rejected
 automatically, and attempting to subscribe seemed to be me in
 account-moderation-limbo. I'd be happy to be post there once I'm able to.

It uses the same mailman install as this list does, configured in a standard
fashion, and I see no mail from you so evidently you didn't try and contact
the listadmin.

Please try and subscribe again, and contact me at the provided address if
you continue to have problems.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] Catalyst::Plugin::Authentication::logout() true?

2007-07-22 Thread Matt S Trout
On Sun, Jul 22, 2007 at 01:37:05PM -0700, apv wrote:
 Should Catalyst::Plugin::Authentication::logout() return something  
 true upon success?

I'd more expect an exception on failure. Not being able to log out is an
exceptional condition if ever I heard one.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] question about sharing models with different applications/hosts

2007-07-19 Thread Matt S Trout
On Thu, Jul 19, 2007 at 03:29:38PM -0400, Barry Hoggard wrote:
 I'm investigating migrating an art website hosting service
 (www.artcat.com) from CGI::Application under mod_perl to Catalyst.
 There are 2 parts to the application -- the admin interface for
 clients and the application that serves the pages.  Eventually the two
 may be served on different servers, such as clientsite.com and
 admin.artcat.com.  They would need to use the same model classes of
 course.
 
 What is considered the best way to do this now?  One catalyst app with
 different vhosts and URL rewriting, or some kind of shared repository
 for the lib directory, or something else?

I'd tend to use one DBIC schema with the domain logic in it and two apps.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] Re: [Catalyst-dev] Announce:Catalyst::Plugin::Authentication 0.10000 Released

2007-07-17 Thread Matt S Trout
On Tue, Jul 17, 2007 at 05:33:52PM +0200, Hartmaier Alexander wrote:
 The Makefile.PL is missing a requirement for Module::Install!

No, the dist is missing inc/

And there's already a new version on CPAN that fixes this :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] Catalyst::Helper passes %T to POSIX::strftime - causes infinite loop under Win32

2007-07-17 Thread Matt S Trout
On Tue, Jul 17, 2007 at 12:32:48PM -0400, bits wrote:
 Catalyst::Helper::_mk_changes calls POSIX::strftime on line 390:
 my $time = strftime('%Y-%m-%d %T', localtime time);
 
 the %T parameter causes my Activestate Perl 5.8.8 820 to infinite loop.  

Odd, it doesn't cause any AS perl I've seen do that.
 
 The perldoc for POSIX states in the strftime notes:
 If you want your code to be portable, your format (fmt ) argument should
 use only the conversion specifiers defined by the ANSI C standard (C89, to
 play safe). These are aAbBcdHIjmMpSUwWxXyYZ% .
 
 %T is not in the list.  On all the systems I have at my disposal, %H:%M:%S
 produces equivalent output and uses only the conversion specifiers they
 recommend.
 
 
 For the sake of saving the next soul who wants to use Catalyst under Win32,
 which apparently doesn't like %T, suggest changing to:
 
 my $time = strftime('%Y-%m-%d %H:%M:%S', localtime time);

While I see no reason at all not to make this change, could you elaborate
on your environment a bit?

This can't be all win32 since I know we've got happy users on win32 and
various perls (although VanillaPerl is getting more and more popular due to
various bits of ActiveState brain damage), so I'm curious now :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] question about retrieving all current Controllers

2007-07-16 Thread Matt S Trout
On Sun, Jul 15, 2007 at 10:59:29PM -0600, Devin Austin wrote:
 Hi all,
 
 I'm trying to figure out how to list all of my controllers on a page like
 the development server does when it starts up.  Is there any way to do this
 or do I have to code something myself?

perldoc Catalyst

look for the 'controllers' method.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] conditional loading of Controllers and Models

2007-07-16 Thread Matt S Trout
On Mon, Jul 16, 2007 at 02:48:50PM +0200, Daniel McBrearty wrote:
 is there a way to have some C's and M's load into catalyst
 conditionally? for example, if some config variable is set?

Exclude some of them with setup_components config.

Or just do it via @INC manipulation - I use this a fair bit for testing.

Depends what you're trying to achieve really, and you haven't told us :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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::Session installation error

2007-07-13 Thread Matt S Trout
On Thu, Jul 12, 2007 at 12:51:53AM +0300, Octavian Rasnita wrote:
 Hi,
 
 I have tried to install C::P::Session using the cpan shell, and it gave the 
 following error:

Without prove -v output we can't help you.

Please stop posting just the 'make test' output.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] TT2 + CP::Authentication + DBIC gotcha

2007-07-13 Thread Matt S Trout
On Fri, Jul 13, 2007 at 05:31:53PM +0100, Matt Lawrence wrote:
 stephen joseph butler wrote:
 On 7/13/07, Matt Lawrence [EMAIL PROTECTED] wrote:
 Perrin Harkins wrote:
  my $vote = $foo if ($bar);  # --- bad!
 
 What's wrong with that? I find it a lot more readable than
 
 my $vote;
 if ($bar) {
 $vote = $foo;
 }
 
 It doesn't work this way, but suppose you wrote this:
 
 if ($bar) {
  my $vote = $foo
 }
 
 Now see why it's wrong? The way you wrote it is kind of ambiguous for
 the way we think of postfix operators. If you want something one line,
 how about this:
 
 my $vote = $foo ? $bar : undef;
 
 I can't replicate this behaviour. As far as I can tell, the postfix if 
 is identical to the block if I wrote above.
 
 
 perl -Mstrict -wle 'my $foo = 1 if 0; print defined $foo ? $foo : undef'
 undef
 
 
 Has the bug been fixed?

No, because people use the if 0 construct as a way to create a static.

cain$ re.pl 
$ sub foo { my $foo if 0; $foo++; } 
$ foo();
0   
$ foo();
1   
$ foo();
2   
$ 

However in 5.10 you -will- get a warning using this construct since it almost
always indicates buggy code; the number of people who actually -need- a
static rather than just a lexically closed-over var is vanishingly small and
they can explicitly turn off the behaviour themselves.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] DBIC puking on relationships from objects within TT2 but not from stash objects

2007-07-07 Thread Matt S Trout
On Fri, Jul 06, 2007 at 09:30:38PM -0700, apv wrote:
 False alarm. I figured it out. Have to prefetch relationships when  
 putting the user into the session at login or the goodies just ain't  
 in the session info.

The user object is re-retrieved by the auth plugin anyway, so

$c-user-obj-votes

will work.

if you're storing a 'user' object in the session, something like

$c-session-{user}-result_source($c-model('DB')-schema-source('User'));

will restore the result source.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] Ask Catalyst: What are your prefered DB and HTML abstraction layers ?

2007-07-07 Thread Matt S Trout
On Thu, Jul 05, 2007 at 09:58:29AM +0200, Alexandre Jousset wrote:
   Hello list,
 
   I started a project using Catalyst with DBIx::Class and FormBuilder. 
 This is far from a CRUD application. In fact it is a Slashdot-like 
 application.
 
   I've heard about Rose and I'm planning to move from FormBuilder to 
 Rose::HTML::Object that seems better designed.
 
   My real question is: should I also change the DB abstraction layer 
   from DBIx::Class to RDBO ? Would this be more consistent? Does it worth 
 it? 
 Or can I live without it? I'm thinking in the long term.

Since nobody else seems to have replied, I'll take a stab.

I know quite a few people who've used RHTMLO with DBIC to great success, so
a switch to RDBO definitely isn't -necessary-.

On the other hand, I think the Catalyst::Controller::Rose stuff gives you
out of the box integration so your question really is twofold -

(1) Will it be more work to get your RHTMLO-DBIC integration going than
it would be to port to RDBO and get RHTMLO-RDBO integration going?

(2) Do you need any of the features DBIC provides that RDBO doesn't? (resultset
chaining and support for GROUP BY/HAVING being the obvious candidates)

Equally, (2) can be flipped, asking whether the features RDBO provides that
DBIC doesn't (which I'm obviously not as clear on the list of :) are worth
the effort of porting.

In the long term I personally don't see RHTMLO remaining the state of the
art in terms of form generation, but equally I do see it being the closest
to good enough of the currently available options so perhaps you won't need
to switch even when a better solution becomes available.

RDBO is a very well-engineered project, and while it has a more measured
development pace than DBIx::Class that does result in it being a bit more
polished in places and the documentation is excellent.

So ... I don't really have a straight answer for you. I know of quite a few
devs who've gone both routes and been happy with it, and I can't really say
whether one route is better or not - I think what I'd do is create a quick
one-table test app using Catalyst::Controller::Rose, and port one of your
current DBIC+FB controllers to DBIC+RHTMLO, and then decide at that point
which approach you like better.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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 a persistent hash in a model

2007-07-07 Thread Matt S Trout
On Sat, Jul 07, 2007 at 04:52:19PM +0200, Daniel McBrearty wrote:
 Hi
 
 I want to use a persistent hash in a model, using (I guess) Storable.
 The hash would get inititalised in new, and modified in the model. I
 would use lock_store to save any changes as data is modified in the
 model class.
 
 This would be OK in the test app, but as the app will get used under
 fast_cgi, is this safe? Given that there can be a number of cat
 instances running, presumably there will be as many model classes, and
 therefore they will not be in sync as data is updated?
 
 Is there any easy way to keep some ad-hoc persistent data out of the 
 database?

For a single machine deployment I'd try DBM::Deep

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] including InflateColumn::DateTime

2007-07-06 Thread Matt S Trout
On Thu, Jul 05, 2007 at 02:55:33PM -0400, John Goulah wrote:
 Perhaps this is better for the DBIC list so try not to flame me if I need to
 repost there.

Hint: If your entire question is expressed without any mention of a class
within the Catalyst:: namespace, but two within the DBIx::Class:: namespace,
the answer is probably yes.

We're doing our best to be nice to you, but the reason you're starting to get
flamed is time and again you're clearly not giving basic thought to what area
your problem lies before posting - please try and apply the rule of thumb
above and you'll find you get shot at much less often :)

 The main reason I ask is because I'm using the new SchemaLoader version to
 regen my schema, and altering the line above the md5sum prevents
 modification of that file, so ideally if I could just load this up somewhere
 else that would work better. Also its sort of a pain to add the same exact
 thing to each Schema file where I use Datetime fields-

Have a read through

http://search.cpan.org/dist/DBIx-Class-Schema-Loader/lib/DBIx/Class/Schema/Loader/Base.pm#CONSTRUCTOR_OPTIONS

there are a couple to do with base classes, at least one of which I believe
will do the trick for you (working out which one left as an exercise to the
person reading the documentation :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] html::prototype syntax in new Cat version

2007-07-05 Thread Matt S Trout
On Thu, Jul 05, 2007 at 06:23:21AM +0300, vb wrote:
 
 There is absolutely no reason to use Prototype.
 
 
 The Prototype + Scriptaculous javascript framework is junk.
 
 
 There is absolutely no reason to use... Prototype + Scriptaculous
 
 It doesn't work very well, the syntax is terrible, it will break other
 javascript on the page just by being included
 
 
 This is not true, for prototype.js (including the syntax wich is as it is
 in OO-javaScript...).
 I have a working application in which is used prototype.js, tinyMCE.js,
 tabber.js (from Patrick Fitzgerald) with Catalyst and TT. Many complex
 applications (and widgets) exists, based on prototype.js.

Complex applications can be written using shit tools.

It doesn't stop them being shit.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] Uniform treatment of all parameters (including file uploads)

2007-07-04 Thread Matt S Trout
On Wed, Jul 04, 2007 at 11:29:12AM +, Zbigniew Lukasiak wrote:
 On 7/3/07, Matt S Trout [EMAIL PROTECTED] wrote:
 No, because this would break the ability to pass the request object to
 something expecting the CGI.pm API, and break compat for existing app code.
 
 I think you meant Apache::Request because the current implementation
 is not compatible with CGI.pm.

My mistake.

 Maybe have a think about what you'd like to see from a completely new
 unified API and propose that?
 
 So my wishlist would be: -upload to return the filehandle (for
 compatibility with CGI), -param to return Catalyst::Request::Upload,
 and make Catalyst::Request::Upload stringify to the filename.  If we
 could also make Catalyst::Request::Upload work as a filehandle in
 angle brackets it would be entirely compatible with CGI.pm (but not
 with Apache::Request).

That looks like it'd improve compat, give you what you want, and not
break any existing code, unless I've misunderstood your logic. Assuming
I haven't, I'd love to see a patch to do this - does anybody else have
any thoughts?

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] Uniform treatment of all parameters (including file uploads)

2007-07-03 Thread Matt S Trout
On Tue, Jul 03, 2007 at 04:25:30PM +, Zbigniew Lukasiak wrote:
 I constantly bump into the mismatch in the treatment of 'normal'
 params and the file uploads.
 
 Wouldn't life be simpler if
 
 $c-request-param( 'file_field' )
 
 would return a Catalyst::Request::Upload object (or an array of them)?

No, because this would break the ability to pass the request object to
something expecting the CGI.pm API, and break compat for existing app code.

Maybe have a think about what you'd like to see from a completely new
unified API and propose that?

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] How to access current MyApp instance ?

2007-07-01 Thread Matt S Trout
On Sun, Jul 01, 2007 at 05:51:50PM +0400, Oleg Pronin wrote:
 Because [%Game.detailsHref%] or [%Game.historyHref%] is much easier and
 faster to call then
 [%INCLUDE game_hrefs game=Game type='details'%]
 
 As a temporary fast solution i use this:
 in root controller's auto action:
 MyApp-c($c);
 weaken(MyApp-c);
 
 from anywhere: $c = MyApp-c;

Congratulations, you just reinvented Catalyst::Plugin::Singleton.

You should still be using ACCEPT_CONEXT though.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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

2007-07-01 Thread Matt S Trout
On Sun, Jul 01, 2007 at 06:50:36PM +0400, Oleg Pronin wrote:
 OptiPerl does. The coolest IDE for perl i ever seen
 http://xarka.com

Wake me up when they release a version for an OS worth doing dev work on.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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

2007-06-30 Thread Matt S Trout
On Sat, Jun 30, 2007 at 04:43:57PM -0500, Tom Printy wrote:
 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.

I've not yet found anything that beats four 80x25 xterms running screen
plus bash plus vi :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] Template rendering error under mod_perl

2007-06-29 Thread Matt S Trout
On Fri, Jun 29, 2007 at 11:49:33AM +0100, Richard Jones wrote:
 Kiki wrote:
 Richard Jones wrote:
   
 Having developed my application sufficiently to see it working well so
 far, I though I should configure it to run under mod_perl. I have used
 the TTSite helper to generate the templates. The app runs fine using
 myapp_server.pl, but under mod_perl I get the following:
 
 Couldn't render template file error - login.tt2: not found
 
 
 Could be a permission issue, has the user the webserver runs under
 access to that path / those files?
 
 
 ___
   
 The user/group permissions on root/src and root/lib and the files 
 therein are the same as for lib/MyApp.pm, so presumably that isn't the 
 issue? There is nothing obvious in the error_log, though Apache doesn't 
 seem to log file permission errors even under debug mode. 

Apache may load code while still root.

su to the user it runs at and try to cd into the MyApp dir and cat a template
file.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] Template rendering error under mod_perl

2007-06-29 Thread Matt S Trout
On Fri, Jun 29, 2007 at 04:33:46PM +0100, Richard Jones wrote:
 This is getting weirder - if I try to load a page normally available 
 only after login, I get another path error in addition to the template 
 error:
 Form (search): Can't find form config search.fb in: 
 /home/raj/www/apps/MyApp/root/forms, yet search.fb is most definitely 
 present in /home/raj/www/apps/MyApp/root/forms. All root sub-dir files 
 set to 0644 permissions, with user/group set to same as other web files. 
 What gives?

The directory needs to be 755.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] Proper way to perform cleanups on server shutdown?

2007-06-27 Thread Matt S Trout
On Wed, Jun 27, 2007 at 02:38:34PM -0700, John Napiorkowski wrote:
 Hi,
 
 I'm finding that the way I usually catch shutdown
 signals to perform cleanup is not working.  Setting
 %SIG handlers doesn't seem to do it and I'm not
 finding that DESTROY methods are getting fired off in
 the expected way.
 
 For example if I set a $SIG{INT} handler in the
 application class (MyApp.pm) that get's called if I am
 running the development server foregrounded and the
 interrupt it with a 'ctrl-c', but it doesn't get
 called if the development server is deamonized and I
 kill the process.  $SIG{QUIT} doesn't seem to do it. 
 DESTROY doesn't seem to every get called.

Add some better traces - I suspect this is either (a) a DBIC problem fixed
in 0.08 or (b) a problem that isn't that you didn't give us a test case for
yet :)

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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] instantiating persistent DBHs: MyApp.pm? Model?

2007-06-25 Thread Matt S Trout
On Sun, Jun 24, 2007 at 05:17:32PM -0600, Todd Harris wrote:
 Hi Matt -
 
 Thanks for the tip!  Yep, this makes sense and works well.
 
 I'm still relying on my old code for an oo database with no driver.   
 I'm looking to interface more directly with DBIC if possible in the  
 future, but for now, things are working as expected.

Bear in mind you can (a) get the $dbh out of a DBIC model, (b) pass a subref
to a DBIC model to return a $dbh from elsewhere (this works in plain DBIC as
well but I figure you care more about the cat case). Between the two it's
pretty much always possible to mix and match DBIC and legacy/specialised
stuff and still have a single DB connection.

But hell, if it works for now, sorted :D

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical DirectorWant a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ 

___
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/


  1   2   3   4   5   6   >