Re: [Catalyst] fcgid

2008-09-30 Thread Matt S Trout
On Mon, Sep 29, 2008 at 09:46:42AM -0400, John Lee wrote:
> Matt S Trout wrote:
> > fcgid is designed for shared hosting. it's basically useless for dedicated
> > setups.
> > 
> >> I ask this, because it seems that it works better than fastcgi, it is 
> >> maintained and prefered, but I can't see why.
> > 
> > mod_fastcgi is maintained, just minimally and quietly, and it works
> > perfectly.
> > 
> > For dedicated setups it's the only option; I dunno who you think prefers
> > fcgid but I'm certainly not one of them.
> > 
> 
> Hmm, now I'm all confused.  We'd recently switched to mod_fcgid from
> handling fastcgi with lighttpd, due to its better process management.
> However, I'm always akin to trying new things, so this piques my
> curiosity around mod_fastcgi.
> 
> What's the general concensus in the catalyst community nowadays?  Is
> mod_fastcgi preferred at large over mod_fcgid these days? 

You shouldn't let your fastcgi module do process management at all, anyway,
that's what FCGI::ProcManager is for - and by having the fastcgi stuff
external you can, as Peter Karmen points out, bounce the application
separately. Not only that but you can do zero-downtime upgrades by starting
the new version on the same socket -before- stopping the old version.

> I saw a post
> from Jonathan Rockaway almost two years ago noting that "mod_fastcgi is
> crufty and slightly broken, while mod_fcgid seems to be more sane",

*shrug*

Jon's an apps dev. I'm ex-operations and design system deployment strategies
on a regular basis. His opinion doesn't count in my world, I don't let client
developers anywhere near systems stuff if I can help it :)

Note though that fcgid -is- more sane for shared hosting and for the web
server doing process management.

But as noted above, for dedicated production deployments you don't want that
anyway, and mod_fastcgi isn't broken at all, it's just picky about its config
sometimes :)

Also, mod_fastcgi isn't maintained as "actively". But that's because it
already works, so they just put out the occasional bugfix release :)

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] DBIx::Class and Catalyst - Trying to make sense of it all.

2008-09-29 Thread Matt S Trout
On Sun, Sep 28, 2008 at 10:15:25AM -0400, Leanan Sidhe wrote:
> First, I apologize for the completely noob tone of this email.  I've read
> through the perl docs for DBIx::Class, and various Catalyst parts, but I'm
> having problems understanding how DBIx::Class stuff is slightly different in
> Catalyst.
> 
> For example, in the DBI docs, I constantly see the following:
> 
> $schema->resultset('table_name')->search();

No you don't.

The argument to resultset is the source name, which is by default the last
part of the class name.

So for My::Schema::Foo, it'd be $schema->resultset('Foo'), the table name
could be 'tbl_foobar_baz' or whatever for all DBIx::Class cares so long as
you pass that to ->table.

> in Catalyst, this seems to be
> $c->model('table_model_package')->search();

No. Basically for each valid argument to $schema->resultset,
Catalyst::Model::DBIC::Schema sets it up so that

$c->model('NameOfModel::${arg_to_resultset}') is a shortcut to
$c->model('NameOfModel')->schema->resultset($arg_to_resultset).

> I get that and it's not too rough.
> 
> But then where I get hung up is that I have a few table relationships I want
> to query.  Say I have the following tables / relationships:
> 
> users:
>   user_id
>   user_name
>   pass
> 
> cards:
>   card_id
>   card_name
>   card_description
>   set_id
> 
> sets:
>   set_id
>   set_name
> 
> user_cards:
>   id
>   user_id
>   card_id
> 
> A card has a set
> A set has many cards
> A card has many user_cards
> A user_card has a user
> A user_card has a card
> 
> Now, say I want to have a page that lists out all the cards a user has.
> Right now I have one user, so I'm not doing much on the user id.  Ok, that's
> simple, I just do:
> 
> my $user_cards = $c->model('Model::for::UserCards');
> my $cards = $user_cards->search_related('cards');

That's completely wrong.

What you want is:

my $user = $c->model('ModelName::User')->find($user_id);

my $cards = $user->cards;

If you're using Catalyst::Authentication::Store::DBIx::Class you can do

my $user = $c->user->obj;

to get the DBIC object for the user.

If you want more information on using DBIx::Class, please post to the
DBIx::Class list - the $c->model shortcut for $schema->resultset is the
-only- thing that's different between normal DBIC usage and DBIC under
Catalyst, and that's not so much a difference as an extra handy feature :)

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] minor typo in Catalyst::Authentication::Store::DBIx::Class::User

2008-09-28 Thread Matt S Trout
On Fri, Sep 26, 2008 at 11:17:05AM -0400, John Romkey wrote:
> In 0.106, line 89 calls Catalyst::Exeption->throw
> 
> should be Catalyst::Exception->throw

I can't find anything remotely like this in svn to apply to - what path
and revision did you patch against?

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] How to send raw HTTP response

2008-09-27 Thread Matt S Trout
On Thu, Sep 25, 2008 at 08:35:14PM +0200, Christian Lackas wrote:
> Hi Everybody,
> 
> is it possible for a controller method to directly produce the raw HTTP 
> response?
> My application generates a (potentially large)) ZIP file on the fly,
> which I don't want to store (on disk or in memory) but rather send it
> directly to the client while producing it.
> 
> In a CGI script I use Archive::Zip such as
> 
> print CGI::header(...);
> $ZIP->writeToFileHandle(*STDOUT);
> for my $f (@files) {
> $ZIP->addFile($f, basename($f));
> }
> 
> How can I achieve something similar under Catalyst?

Just call $c->write($chunk) with each chunk of data as you get it.

Catalyst will automatically send headers before the first chunk for you.

Do -not- rely on STDOUT being an appropriate filehandle to print to, that's
an accident of the engine design and could easily 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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Chained Regexes

2008-09-27 Thread Matt S Trout
On Wed, Sep 24, 2008 at 07:10:38AM -0700, Ovid wrote:
> Pursuant to a refactoring issue I explained at 
> http://use.perl.org/~Ovid/journal/37525, it would be nice if I could mix 
> regexes with Chained actions.  There are some nice refactoring potential.  
> Plus, by allowing me to apply a regex to a CaptureArg or Arg, I could get 
> 404s for free.  Having to write this manually is a bit disappointing.

The solution here is to implement match_captures to do for captures what
match on action objects already does for args.

Having done that, your action class can do pretty much whatever the hell it
wants, regexps or db lookups or etc.

-- 
      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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] getting database handles and run arbitrary SQL

2008-09-27 Thread Matt S Trout
On Wed, Sep 24, 2008 at 12:15:08AM -0700, theshz wrote:
> Hi, I'm new to Catalyst, just went through the Tutorial, everything worked 
> fine. But for my reporting application (part of a bigger application where 
> CRUD will be more often), I need to run some complicated querries. I did find 
> the "Arbitray SQL" article in DBIx's FAQ, but I don't even know how to get to 
> DBIx, if that's the right way, more specifically, 
> 
> Is it possible to get the database handle and run SQL directly as in DBI? I 
> read that from Schema I can get its storage, which is the db handle. But from 
> a Controller, how do I get the schema object, or the db handle? If the DBIx 
> is the correct way to go (which seems a lengthy way to "just" run a query), 
> do I do $c->model('Some::Model')->resultset?

If you aren't planning to use DBIx::Class at all, I'd recommend
Catalyst::Model::DBI

If you're using DBIx::Class, I'd recommend abstracting the query away behind
a resultset method - something like

sub my_custom_query {
  my ($self, @args) = @_;
  my $code = sub {
my $dbh = shift;

  };
  $self->result_source->schema->storage->dbh_do($code);
}

If this example isn't sufficient, you should be asking on the dbix-class
list, not here.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Slow template processing on debian lenny

2008-09-27 Thread Matt S Trout
On Mon, Sep 15, 2008 at 02:17:22PM +0530, Terence Monteiro wrote:
> Hi,
> 
> I've been using TT for years and enjoy the features it provides. In one of
> my Catalyst applications, I'm processing a template which generates HTML to
> give me a table with counts taken from a hash. I'm using a lot of nested
> FOREACH to generate the table.
> 
> On my machine, an ubuntu hardy, it works fast - about 2.5 seconds to
> process the template. On a production server using debian lenny, it used to
> take around the same amount of time. But recently, I upgraded it to libperl
> 5.10 and updated the different Perl modules including Template and
> Catalyst::View::TT. After this upgrade, the same template takes 25 seconds
> on average to process. The times I am mentioning are the times taken on the
> server side, as shown by the Catalyst application debug logs.

Use Devel::NYTProf to find out what specific piece of code causes the
slowness.

Currently you're just waving a torch around in a 20 mile wide pitch black
cave - sure, there's illumination involved, but not of anything relevant to
your problem.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] fcgid

2008-09-27 Thread Matt S Trout
On Sun, Sep 14, 2008 at 03:00:48PM +0300, Octavian Rasnita wrote:
> Hi,
> 
> I understand that comparing it with mod_perl, fast CGI has the advantage of 
> allowing us to restart the applications without restarting the server.
> But I have also understood that fcgid don't allow using the app as an 
> external server.
> 
> If this is true, than which is the advantage of fcgid?

fcgid is designed for shared hosting. it's basically useless for dedicated
setups.

> I ask this, because it seems that it works better than fastcgi, it is 
> maintained and prefered, but I can't see why.

mod_fastcgi is maintained, just minimally and quietly, and it works
perfectly.

For dedicated setups it's the only option; I dunno who you think prefers
fcgid but I'm certainly not one of them.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] #catalyst

2008-09-24 Thread Matt S Trout
On Sat, Sep 13, 2008 at 10:09:26PM -0500, Jonathan Rockway wrote:
> * On Sat, Sep 13 2008, Zbigniew Lukasiak wrote:
> > Hi there,
> >
> > I did not see how it looked like at the channel a few days ago - but I
> > hope that my irc client malfunction did not offend someone too severly
> > (unlike that famous wardrobe of some US pop singer).  And that the
> > bane for my home machine is not eternal and can be released soon.
> 
> You're unbanned now.  In the future, just /msg an op (usually mst) and
> they will take care of it (especially if it's because your client
> malfunctioned).

Yeah. The problem was the malfunction meant I also couldn't effectively
/msg you to say it was just a tempban.

And then I was off to IPW and had no internet and forgot to unban you
before I left because I suck :)

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] One (central) app, one schema, X databases

2008-09-24 Thread Matt S Trout
On Wed, Sep 10, 2008 at 10:42:35AM +0100, Chisel Wright wrote:
> I'm just in the initial planning phase of a project.
> 
> The basic idea is to have X locations running App::Location, each with a
> local database that has a App::Location::Schema.
> 
> Everything's the same, just different data in the locations.
> 
> We'd like to have a centralised tool to manage App::Location #1 ...
> App::Location #X - App::Central
> 
> App::Central may have it's own App::Central::Schema, but it should also
> be able to interact with App::Location::Schema #1 ..
> App::Location::Schema #X.

If you only need one location at once, use the approach I was discussing
in an earlier thread for multiple users.

If you need multiple, maybe add an ACCEPT_CONTEXT onto your M::DBIC::Schema 
that takes a location name, and then modify 

*{"${classname}::ACCEPT_CONTEXT"} = sub {   
shift;  
shift->model($model_name)->resultset($moniker); 
}   

in M::DBIC::Schema itself to do ->model($model_name, @_) then you can do
        
$c->model('DB::Foo', 'location1');

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Race condition in Catalyst::Plugin::Session and Catalyst::Engine::Apache (possibly other engines too)

2008-09-24 Thread Matt S Trout
On Wed, Sep 10, 2008 at 06:59:21PM -0400, Sergio Salvi wrote:
> There is a race condition in C::P::Session when using
> C::Engine::Apache (and probably other engines too):
> 
> I have a simple controller action (let's call it /save) that gets data
> submitted from an HTML form via POST, process that request, stores
> some stuff in the session and flash and then redirects with HTTP 303
> to another action (/display).
> 
> The /display action then displays the regular "submit successful"
> message that was set on the previous action by using $c->flash. The
> problem is that the browser is GETting /display before /save is
> finished storing the session and flash rows in the database. Then, of
> course, /display thinks nothing has happened and doesn't display the
> data from flash.
> 
> After a bunch of debugging and stack traces :), I figured out the
> problem is that C::P::Session's finalize() calls $c->NEXT::finalize()
> before calling $c->finalize_session, so
> C::Engine::Apache->finalize_body() gets executed *before* the session
> is flushed in the database, making the browser access /display even
> though the session may not be stored yet:

This was changed by Bill Moseley in order to fix a bunch of other bugs.

Have a look at the ChangeLog - maybe we could provide an option to reverse
the order or find another approach?

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Multiple DB, single instance of Cat

2008-09-24 Thread Matt S Trout
On Thu, Sep 11, 2008 at 11:58:31PM +0100, Nigel Stuckey wrote:
> Matt
> 
> I stand corrected on DBIx! Yes, indeed I mean DBIx::Class.
> 
> The code is in and works, but has a couple of issues. Firstly, it  
> creates new classes and carries out a DB connect every time there is  
> a request. Is there a way to make it more efficient by caching the  
> classes and DB connects once there is a successful authentication?

It should only be creating a new $schema object, see below.

No reasony you can't do

__PACKAGE__->mk_accessors('connection_cache');

and then set that to {} somewhere early and keep the $schema objects in
there.

I didn't do this in my example because (1) IT WAS A SIMPLE EXAMPLE (2)
writing caching code is simple, except you need to handle cache expiry
and stuff and I didn't have time to write example code for all of that :)
 
> Secondly, there are loads of 'ACCEPT_CONTEXT redefined' messages, one  
> per DB table defined to the DBIC model. When initialising, I have to  
> give the 'dynamic' model an initial configuration to allow Catalyst o  
> start.

Ah, the class creation and stuff shouldn't be happening. That's me being
silly, what you want to do is

my $new = bless({ %$self }, ref($self));

to bypass the initialisation phase.

> Once the code is working I will pop it on the wiki.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Database contents not displayed after hitting pagerefresh

2008-09-10 Thread Matt S Trout
On Wed, Sep 03, 2008 at 04:03:27PM +0530, SHARATH GOPINATH RAO,  Chennai wrote:
> 
> Matt: "So it works on the first request but not on the second?"
> 
> Yes, it works on the first request and not on second. But, after
> changing it to this: $data = $c->model('Ttrack::Ttrack')->search();
> it's working fine, although any more suggestions are welcome.

It is *not* working, you've just papered over the underlying problem.

Please debug as I suggested otherwise in a few months your app is going to
break again.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Intermittent blank pages

2008-09-03 Thread Matt S Trout
On Wed, Sep 03, 2008 at 01:45:47PM +0300, Octavian Rasnita wrote:
> From: "Matt S Trout" <[EMAIL PROTECTED]>
> > You might want to load Catalyst::Plugin::AutoRestart as well so the 
> > processes
> > restart themselves gracefully at the end of a request before it hits the
> > softlimit.
> 
> Do you know if there is a similar solution that can be used under Windows?

Write one and send it to the authors, I'm sure they'd be happy to take a
patch.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Database contents not displayed after hitting pagerefresh

2008-09-03 Thread Matt S Trout
On Wed, Sep 03, 2008 at 04:03:27PM +0530, SHARATH GOPINATH RAO,  Chennai wrote:
> 
> Matt: "So it works on the first request but not on the second?"
> 
> Yes, it works on the first request and not on second. But, after
> changing it to this: $data = $c->model('Ttrack::Ttrack')->search();
> it's working fine, although any more suggestions are welcome.

You have an ancient version of something then that's caching the resultset.

Upgrade Catalyst::Model::DBIC::Schema and DBIx::Class.

->search() is just a copy constructor. Emanuelle doesn't know what the fuck
he's talking about.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Database contents not displayed after hitting page refresh

2008-09-03 Thread Matt S Trout
On Tue, Sep 02, 2008 at 09:48:08PM -0700, cranky wrote:
> 
> Hi, I'm a newbie to catalyst. I have built a small app, similar to the one in
> catalyst manual (basic CRUD). I have a page wherein a  displays its
> contents after getting it from the database (SQLite3), the problem is, it
> doesn't display the contents after I refresh the page.

So it works on the first request but not on the second?

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Database contents not displayed after hitting page refresh

2008-09-03 Thread Matt S Trout
On Wed, Sep 03, 2008 at 09:04:23AM +0200, Emmanuel Quevillon wrote:
> You need to perform a search in your 'ShowData' function to get data
> returned by the Resultset of your model 'Ttrack::Ttrack'.
> At this time, $data is only a resultset object without any data in it.
> Replace :
> 
> my $data = $c->model('Ttrack::Ttrack');
> 
> with
> 
> my $data = $c->model('Ttrack::Ttrack')->search();

No, don't do that.

Those two lines are exactly equivalent except that ->search will cause
a completely pointless clone of the resultset.

$c->model('Ttrack::Ttrack') is -already- a resultset for the whole table.

That's why there's something in there to search on.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Intermittent blank pages

2008-09-03 Thread Matt S Trout
On Thu, Aug 28, 2008 at 05:44:31PM +0200, Tobias Kremer wrote:
> Quoting [EMAIL PROTECTED]:
> > Tobias Kremer <[EMAIL PROTECTED]> wrote on 08/28/2008 09:02:24 AM:
> > > Quoting Sebastian Willert <[EMAIL PROTECTED]>:
> > > > Are you using Perlbal in front of FastCGI? Perlbal is prone to deliver
> > > > blank pages if the back-end times out. Unfortunately I haven't found
> > > > a way to avoid this behavior, but maybe someone on the list can help
> > > > out ...
> > > No, we're using lighttpd and nothing changed on that front during the
> > last two
> > > days :(
> > Are they delivered instantly or after a long pause?
> 
> Instantly.
> 
> I just noticed that shortly after a series of those errors appear in the error
> log, the process gets killed off (and restarted) by daemontools' softlimit due
> to memory constraints.

You might want to load Catalyst::Plugin::AutoRestart as well so the processes
restart themselves gracefully at the end of a request before it hits the
softlimit.

I notice downthread you've solved the underlying problem, but adding
AutoRestart into your setup would mean that if something similar goes wrong
again you'll avoid the firing blanks problem.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] "Global $r object is not available" error

2008-09-03 Thread Matt S Trout
On Wed, Aug 27, 2008 at 05:22:12PM -0700, Bowei Chi wrote:
> Hi List,
> 
>  
> 
> I'm configuring apache mod_perl to work with Catalyst according to the
> cookbook, but this error showed up when I restarts apache.  It occurs
> when my catalyst application tries to start up by calling
> "__PACKAGE__->setup;"
> 
>  
> 
> [error] Global $r object is not available. Set:
> 
> PerlOptions +GlobalRequest
> 
> in httpd.conf at /usr/lib/perl5/5.8.6/CGI.pm line 361.
> 
> Compilation failed in require at (eval 2) line 3.

Hrm. Catalyst under mod_perl shouldn't need CGI - Catalyst itself uses
CGI::Simple.

So I think the problem is something you've loaded, not Catalyst core.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Duplicate entries with C::P::Session::Store::DBIC and MySQL - new findings

2008-08-27 Thread Matt S Trout
On Wed, Aug 27, 2008 at 10:41:11AM +0200, Tobias Kremer wrote:
> Quoting Moritz Onken <[EMAIL PROTECTED]>:
> > Am 27.08.2008 um 10:19 schrieb Tobias Kremer:
> > > Ok, a second glance (after the first coffee) revealed that the
> > > separation is indeed there :) The question is, why?
> >
> > Just guessing:
> > not every request has its own session object. There are users with no
> > session attached to them.
> 
> That was my first guess, too. But AFAICT each and every user receives a 
> session
> on its first visit - logged-in or not.

Only if you write to $c->session.

But if you write to $c->flash, then you have to create a cookie, so I guess
you're effectively creating a session anyway.

So as long as you have to write to one of the two to create a session, I
don't really see a problem.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] FormFu / FormBuilder + Custom Actions

2008-08-26 Thread Matt S Trout
On Tue, Aug 26, 2008 at 10:30:47AM -0400, Rod Taylor wrote:
> Both FormFu and FormBuilder controller "Actions" appear to have issues
> with their special variables disappearing when using an additional
> ActionClass.

An object can't be blessed into two classes at once.

If you want to add an extra class, create an action class that inherits
from both the FormFu one and the additional one and :ActionClass that.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Win32, Data::Alias, bad idea or my bad?

2008-08-26 Thread Matt S Trout
On Tue, Aug 26, 2008 at 03:20:14PM +0200, Kai Andresen wrote:
> Hello all,
> 
> I've been trying to get a nice litle Catalyst application to run on
> developers win32 machines the recent week.
> 
> Strawberry, ActiveState and Cygwin. All fail on something, but they all fail
> on building Data::Alias, which both Configloader and RenderView depends
> upon.

Yep, previous thought confirmed. force for the moment, there'll be a
Data::Visitor release that doesn't ask for Data::Alias shortly.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Win32, Data::Alias, bad idea or my bad?

2008-08-26 Thread Matt S Trout
On Tue, Aug 26, 2008 at 03:20:14PM +0200, Kai Andresen wrote:
> Hello all,
> 
> I've been trying to get a nice litle Catalyst application to run on
> developers win32 machines the recent week.
> 
> Strawberry, ActiveState and Cygwin. All fail on something, but they all fail
> on building Data::Alias, which both Configloader and RenderView depends
> upon.
> 
> Mostly I've tried builds of perl 5.10, but I also tried Strawberry 5.8.8,
> only to have Data::Alias demanding => 5.8.9

Looking at the CPAN testers results it -should- build under 5.10.0 - there
are a couple of PASS results for 1.07 there on

http://cpantesters.perl.org/show/Data-Alias.html

It's required by Data::Vistor as a dependency, but only for a specific
feature which I -don't- think we actually turn on. It'd suggest you try
forcing Data::Visitor, see if everything else installs ok, and if so
don't worry about it and we'll try and arrange a Data::Visitor release
that makes the dependency optional.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Patch for Catalyst::Authentication::Store::DBIx::Class::User

2008-08-25 Thread Matt S Trout
On Fri, Aug 22, 2008 at 09:42:07AM -0600, Jason Kuri wrote:
> >>On Thursday 21 August 2008 23:12:40 David Jack Wange Olrik wrote:
> >>>Wouldn't it be neat to have the username field configurable, just
> >>>like 'password_field' ?
> >>
> >>You don't need that, read this:
> >>[ ... ]
> >>Basically you pass whatever hashref you need to $c->authenticate. The
> >>password_field is necessary because of the possible changes done by
> >>Credential::Password .
> >
> >I think the point is that it should be possible to rename fields on
> >the
> >DBIC side without eneding to change your $c->authenticate line.
> 
> I disagree.  The goal seems to be to loosely bind to the DB fields
> from the auth side.  This should be handled long before the
> DBIx::Class store.
> 
> The problem is that If we made 'username' configurable, we would have
> to make every field configurable.  We'd need essentially a map of
> 'inbound fields' to 'fields to send to ->search()' because username is
> only one of the possible ways to search users during authentication.
> 
> To do it properly, we'd also have to make a generic way to handle
> values and translate them to what would be in the database.  Taking
> the example from the POD  status => 'active'  in the auth call would
> need to be translatable to a 'user_access_level' field which could
> have the values of 'logged in' 'registered' or 'admin'.
> 
> There are too many more reasonable ways to accomplish this in an
> application that would not be convoluted and would not bury the fact
> that it is occuring at all.  Adding it at the store level would be
> difficult to do well for relatively questionable gain.

Hmm. Actually, I think having the DBIC level be able to keep the mapping
would probably be better.

Which of course means I need SQLA2 and the DBIC collection API I have
planned for DBICMoose.

Which of course means now it's my problem again.

In the friendliest possible way, fuck you you fucking fuck :P

*crawls off into a corner to dream of enough tuits to get all this done*

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] [SOT] cat webmail app?

2008-08-25 Thread Matt S Trout
On Fri, Aug 22, 2008 at 12:38:14PM -0700, Joe Cooper wrote:
> Matt S Trout wrote:
> >Ok. I last looked at webmin about three years ago and it was an appallingly
> >badly written pile of hacks that just happened to work, and had no webmail
> >related component at all.
> 
> Correction:  It's an appallingly badly written pile of hacks that just 
> happens to work on millions of production systems every single day.

That's not a correction. It doesn't disagree with my statement at all.

I've happily used webmin, and would install it tomorrow rather than trying
to roll my own for that purpose. I told the guys working on it pretty much
that at YAPC::NA this year - I'm awful at names so I don't know if you
were one of the people involved in that conversation though.

> It'd probably be wise to think of Webmin/Usermin in context: It is an 11 
> year old project with ~450,000 lines of code, written almost entirely by 
> *one guy* (as a hobby a good deal of that time), that has to run on 
> systems with very old Perl versions.  And, because it is used in 
> hundreds of embedded devices and commercial products, the standard API 
> simply cannot change.  There are 114 standard modules (last time I 
> counted), and several hundred third party modules, and Webmin has never 
> broken backward compatibility for those modules.  A module written 10 
> years ago will work, unmodified, in last weeks Webmin release (it won't 
> participate in logging or ACLs or notifications, but it'll work as well 
> as it did 10 years ago).

Which is a fantastic feat of engineering, and the authors should be
bloody proud of themselves for it. But:

That does -not- mean that the codebase is a good one to start off with
when trying to develop a pluggable catalyst application that can be
easily re-used and extended within other applications, which is why I
brushed it off as not seeming particularly relevant to this conversation.

So if you took my comments as being an insult, or something you needed to
defend against, I'm sorry. I'll take stable, hateful crappy code that works
over beautiful code that doesn't do what I want any day, and I'm sure I've
written even crappier code that's still around somewhere. There's certainly
bits of my work on DBIC and Catalyst that I also consider crap, and would be
just as worried about people taking as an example to work from.

Hope that clears up any misunderstanding - I didn't bother listing the
caveats in my original post because I figured as developers we'd all been
there and we all understood it, but it's perhaps worthwhile my having spelt
it out anyway.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] [Announce] Catalyst-Runtime 5.7099_01 - Developer Release

2008-08-24 Thread Matt S Trout
On Tue, Aug 12, 2008 at 12:27:26PM -0400, Charles Bailey wrote:
> On Mon, Jul 21, 2008 at 5:32 PM, Matt S Trout <[EMAIL PROTECTED]> wrote:
> > On Mon, Jul 21, 2008 at 07:13:37AM -0400, Charles Bailey wrote:
> >> Agreed.  I've had it on TODO for the past two weeks, but getting
> >> hammered at dayjob. Will try to do this week.
> >
> > We're one more dev release short of shipping. Please try because otherwise
> > it'll probably have to wait until 5.80
> 
> Patch attached, following a severe tuit drought. I'm sorry I was
> unable to turn it around faster, but I hope it's useful for the
> future.
> 
> The dispatcher change is trivial; most of the size is tests.  These
> are modelled closely on existing tests, with the thought that
> consistency in the test suite is better than streamlining each case.

The dispatcher change is sadly insufficient.

Because visit() returns, you really need to reset action and namespace.

local is one option, simple code to do so another.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] CatMail list and svn set up

2008-08-22 Thread Matt S Trout
http://lists.scsys.co.uk/ to get onto the list.

http://code2.0beta.co.uk/catmail/svn is the currently empty repository;
anybody who wants an htpasswd line on it should mail m.trout 
shadowcat.co.uk with one and I'll rack 'em up.

-- 
      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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Patch for Catalyst::Authentication::Store::DBIx::Class::User

2008-08-22 Thread Matt S Trout
On Fri, Aug 22, 2008 at 12:31:20AM +0300, Bogdan Lucaciu wrote:
> On Thursday 21 August 2008 23:12:40 David Jack Wange Olrik wrote:
> > Wouldn't it be neat to have the username field configurable, just
> > like 'password_field' ?
> 
> 
> You don't need that, read this:
> http://search.cpan.org/perldoc?Catalyst::Authentication::Store::DBIx::Class#Simple_Retrieval
> 
> if ($c->authenticate({  
>   username => $c->req->params->{'username'},
>   password => $c->req->params->{'password'},
>   status => [ 'registered', 'active', 'loggedin']
>  })) {
> 
> These name => value pairs are used more or less directly in the DBIx::Class' 
> search() routine, so in most cases, you can use DBIx::Class syntax to 
> retrieve 
> the user according to whatever rules you have.
> 
> Basically you pass whatever hashref you need to $c->authenticate. The 
> password_field is necessary because of the possible changes done by 
> Credential::Password .

I think the point is that it should be possible to rename fields on the
DBIC side without eneding to change your $c->authenticate line.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Model::LDAP vs Authentication::Credential::LDAP

2008-08-22 Thread Matt S Trout
On Thu, Aug 21, 2008 at 11:17:05PM -0500, Peter Karman wrote:
> 
> 
> Peter Karman wrote on 8/17/08 2:09 PM:
> > 
> > 
> > Matt S Trout wrote on 8/17/08 12:39 PM:
> >> On Mon, Aug 11, 2008 at 11:49:00AM -0500, Peter Karman wrote:
> >>> I am going to be doing something similar eventually using
> >>> Net::LDAP::Class and either
> >>> C::Model::LDAP or a CatalystX::CRUD::ModelAdapter::LDAP. You might
> >>> look at
> >>> Net::LDAP::Class to see if it makes what you're doing any easier.
> >>
> >> Damn. Net::LDAP::Class reserves ->meta for a crappy metadata object.
> >>
> >> Could that not be called metadata or something to make it easier to use
> >> with catamoose?
> >>
> > 
> > yes, it could. I'll change it for the next release.
> > 
> 
> Thanks for the feedback, Matt. Uploaded as 0.09.

karpet++

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] [SOT] cat webmail app?

2008-08-22 Thread Matt S Trout
On Mon, Aug 18, 2008 at 02:14:41PM -0500, Andrew Kornak wrote:
> On Mon, 2008-08-18 at 10:48 +0100, Matt S Trout wrote:
> > On Fri, Aug 08, 2008 at 05:47:25PM -0500, Andrew Kornak wrote:
> > > http://www.webmin.com/usermin.html
> > > 
> > > Not Cat based but is a fairly complete perl-based, modular, extensible
> > > solution as well as a useful system administration tool. I have used
> > > Webmin and Usermin for many years and highly recommend both.
> > 
> > How does that remotely relate to webmail?
> > 
> 
> As per the web sites I included, Usermin has a fairly complete mail
> module that integrates with spam/virus filters and offers many options
> regarding your mail delivery agent. Webmin and Usermin are BSD-like
> licensed and offer RPM. DEB, and tar source packages. I thought it might
> be a useful starting point or even a reference since it is written
> entirely in perl and is a very mature and well supported project.

Ok. I last looked at webmin about three years ago and it was an appallingly
badly written pile of hacks that just happened to work, and had no webmail
related component at all.

For the sake of us poor stupid people, maybe next time include a more
specific link and some explanation of why that link's in there :)

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Documentation for Catalyst::Model::DBIC

2008-08-21 Thread Matt S Trout
On Tue, Aug 19, 2008 at 02:40:23PM +0530, Terence Monteiro wrote:
> Hello,
> 
> I was looking to move connection info from my application's model DBIC
> class to the YAML configuration, but could not find anything in the pod for
> Catalyst::Model::DBIC::Schema. The only code was:
> 
>   __PACKAGE__->config(
>   schema_class => 'MyApp::Schema::FilmDB',
>   connect_info => [
> "DBI:...",
> "username",
> "password",
> {AutoCommit => 1}
>   ]
>   );
> 
> I could not find any documentation about how to supply a model's
> configuration parameters in the YAML in Catalyst::Model, since this is
> generic to all models. I finally found documentation in
> Catalyst::Model::Adaptor for this, and applied it:
> 
> Model::DBIC:
>   schema_class: 'MyApp::Schema::FileDB'
>   connect_info:
>   - 'dbi:Pg:dbname=myapp'
>   - 'postgres'
>   - ''
>   - AutoCommit: 1
> 
> Can I edit the pod for Catalyst::Model::DBIC::Schema with this example
> and/or Catalyst::Model and send it to the author/documenter?

No.

If you're going to supply an example, it should be .conf (Config::General)
format, since that's the new default.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Announce: Instant AJAX web front-end for DBIx::Class

2008-08-21 Thread Matt S Trout
On Tue, Aug 19, 2008 at 07:37:55PM +0300, Ali M. wrote:
> DBIC is switching to Moose?

Of course.

Catalyst 5.80 has already been ported.

-- 
      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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] DBIx::Class method, "update_or_create_related" - it tries to populate the primary key value of the related object

2008-08-21 Thread Matt S Trout
On Tue, Aug 19, 2008 at 10:43:17AM +1000, [EMAIL PROTECTED] wrote:
> Hello, there, Zbigniew,
> 
>Thanks for the article, "Perl Alchemy - notes of a Catalyst programmer".
> Phew.. Thought I was going insane cause I figured a proper ORM would not
> have this problem.

If you ask DBIx::Class to insert NULL, it inserts NULL.

DBIC doesn't second guess you because it's the thing talking to your
production database.

I'm sorry you think it's a problem that it does what you tell it to.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: list of perl-*.rpm files for a basic Cat install

2008-08-21 Thread Matt S Trout
On Mon, Aug 18, 2008 at 04:00:17PM -0500, James S. White wrote:
> I've already gone through this procedure:
> 
> My notes are here:
> 
> http://github.com/fapestniegd/wcyd/tree/master/scratch/procedures/el5/installing_catalyst_on_el5
> 
> There are a lot of them (~137), Matt an I disagree on the using of CPAN
> instead of real packages. I say "real" packages, because package management
> is as much about being able to cleanly remove the files from a system as
> adding them.

That's what .packlist files are for - you can almost always do

rm -r `cat /path/to/distribution/.packlist`

and if you can't I tend to consider that a bug.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] [PATCH] PageCache and white labelling

2008-08-21 Thread Matt S Trout
On Sat, Aug 16, 2008 at 09:28:57PM +0800, Martin Ellison wrote:
> I am resubmitting this patch *again*, could someone please look at it.

If you can please send the patch -with- the config key fix, as requested,
the PageCache maintainer is waiting to look at that version for you.

-- 
      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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst::Plugin::FormValidato->form method - naming of the method and parameter (call to Data::FormValidator->check)

2008-08-18 Thread Matt S Trout
On Sun, Aug 17, 2008 at 11:32:03AM +1000, [EMAIL PROTECTED] wrote:
> Dear all,
> 
> 1) Since Catalyst::Plugin::FormValidator is considered a "thin" wrapper
> around Data::FormValidator, shouldn't we be keeping the naming
> conventions the same?

Somebody needs to write Catalyst::Controller::FormValidator to replace it
really. There's no reason for this to be a plugin.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] list of perl-*.rpm files for a basic Cat install

2008-08-18 Thread Matt S Trout
On Sun, Aug 17, 2008 at 08:26:25PM +0100, Dermot wrote:
> > But right now, the only thing RHEL/CentOS perl builds are good for is making
> > consultants like us billable hours fixing all the stupid problems and/or
> > moving the client's platform to something else.
> 
> 
> Hardware manufacturer's only release drivers for distro like RHEL? I
> bet there isn't a mention of Debian or Free BSD on HP's site. What are
> the preferred disto's/OS's?

Sure. But Debian and FreeBSD's drivers for that hardware likely work just
as well as the manufacturers' ones.

If you want an OS that doesn't work without downloading half a gig of shit
from the vendor, might I suggest win32 :)

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] [PATCH] PageCache and white labelling

2008-08-18 Thread Matt S Trout
On Sat, Aug 16, 2008 at 09:28:57PM +0800, Martin Ellison wrote:
> I am resubmitting this patch *again*, could someone please look at it.

You only submitted it once, halfway down a thread on the users' list.

Once it's on -dev and fits the changes I've proposed I'll be able to chase
the maintainer for you, as I said in my previous mail.

Until that happens, please try not to get too grumpy :)

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] list of perl-*.rpm files for a basic Cat install

2008-08-18 Thread Matt S Trout
On Sun, Aug 17, 2008 at 10:43:07PM +0100, Dermot wrote:
> Building your own Perl is challenging too. On those disto you will be
> asked to force remove it and it's dependencies. It has the potential
> to break your OS and will certainly compromise your package manager.

No, you won't.

Leave the system perl on there for system-provided things that depend on
perl.

Build your own applications perl for your applications.

You are allowed more than one perl on a system. I've got over a dozen on
the Shadowcat dev server and I know of people with many more than that.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] PageCache and white labelling?

2008-08-18 Thread Matt S Trout
On Mon, Aug 18, 2008 at 12:37:11PM +0800, Martin Ellison wrote:
> 2008/8/18 Matt S Trout <[EMAIL PROTECTED]>
> >
> > ...config should be under 'Plugin::PageCache' as I said - that's the
> > standard for plugin config info.
> >
> > If PageCache is still using old style it'd be nice if you could do a first
> > patch switching it across.
> >
> 
> I'm concerned about doing two things in the one patch; can we do my patch
> first?

That's why I said "first patch", with the one adding functionality coming
after the one that fixes it up to modern standard.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] [SOT] cat webmail app?

2008-08-18 Thread Matt S Trout
On Fri, Aug 08, 2008 at 05:47:25PM -0500, Andrew Kornak wrote:
> http://www.webmin.com/usermin.html
> 
> Not Cat based but is a fairly complete perl-based, modular, extensible
> solution as well as a useful system administration tool. I have used
> Webmin and Usermin for many years and highly recommend both.

How does that remotely relate to webmail?

... also, must chase the authors, one of them was talking about some
Devel::REPL patches.

-- 
      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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Multiple DB, single instance of Cat

2008-08-17 Thread Matt S Trout
On Fri, Aug 15, 2008 at 11:05:03AM +0100, Nigel Stuckey wrote:
> Another question about multiple databases.
> 
> I have an existing application that uses a DBIx DB in the conventional  
> way: as a model initialised at run time. All great so far...

DBIx is the CPAN namespace for DBI extensions. There are hundres of
packages in there and you haven't told us which one of them you're using.

I'm going to assume you mean DBIx::Class but if you want to abbreviate
that please use 'DBIC' - it's really unfair to the authors of other
DBIx:: modules otherwise (compare to people saying "Linux 9" when they
actually mean "Red Hat Linux 9" or whatever :)

> However, I now need to make the application multi-organisation in the  
> same instance of catalyst: users will select their organisation or  
> repository when they login or it will be stored as a preference, etc.  
> Due to the size of the repository, this is implemented as multiple  
> databases. Thus a single running Catalyst instance will need to open  
> several DBs sharing the same schema, dynamically after run time. Then  
> it will have to close unused connections after a while.
> 
> What is the best way to do this with DBIx and where is the best place  
> to store the handles/class references? A key to the active DB can be  
> stored in the session.

Something like the following (please write this up on the wiki once you've
got a working version, mine's typed straight into mutt and obviously
isn't -quite- complete :)

package MyApp::Model::DBIC;

use Moose;

extends 'Catalyst::Model::DBIC::Schema';

with 'Catalyst::Component::InstancePerContext';

sub build_per_context_instance {
  my ($self, $c) = @_;
  my $db_name = $c->session->{db_name};
  my $new = $self->new({ %$self });
  
  $new->schema($self->schema->connect(@connect_info));
  return $new;
}

1;

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] list of perl-*.rpm files for a basic Cat install

2008-08-17 Thread Matt S Trout
On Wed, Aug 13, 2008 at 01:36:34PM -0700, Roderick A. Anderson wrote:
> The perl*.rpm files makes life with a CentOS or a Redhat Perl 
> installation much easier.
> 
> Anything I should add?

A production quality perl.

Dead Rat's usually aren't.

Random patches, silly @INC, Scalar::Util broken every fourth release,
...

I hear the Fedora community finally have access to the perl package for
that, so once their fixes filter down to the enterforaprize versions things
will likely be better.

But right now, the only thing RHEL/CentOS perl builds are good for is making
consultants like us billable hours fixing all the stupid problems and/or
moving the client's platform to something else.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] catalyst start-up

2008-08-17 Thread Matt S Trout
On Tue, Aug 12, 2008 at 10:02:10PM +0100, [EMAIL PROTECTED] wrote:
> Dear List
> 
> I have found a problem when I start up my catalyst project it seams to
> hang in between the following lines
> 
> [info] Hello powered by Catalyst 5.7011
> 
> You can connect to your server at http://localhost:3000
> 
> The only way to resolve this is to ask the other developer to restart
> there instants of code.  We are running on different ports.

That makes no sense.

How does restarting other processes have any effect at all?

Please try and explain the problem in more detail; as it is you've basically
said "it doesn't work but I rebooted it" which is an ok bug report against
windows but not much use to us :)

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Troubleshooting FastCGI error

2008-08-17 Thread Matt S Trout
On Wed, Aug 13, 2008 at 12:40:13PM +0100, Dermot wrote:
> So I have chown apache:apache MyApp directory and it works.
> 
> Is it okay to leave the top level directory and the datafile owned by
> the httpd user? I would have thought all the other code should be
> read-only for other that user.

If you use FastCgiExternalServer you can run the app as its own user.

That's what I usually do.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Cat + DBIC + DBD-Pg + mpm_worker -- Solution

2008-08-17 Thread Matt S Trout
On Wed, Aug 13, 2008 at 11:59:11AM +1000, Toby Corkindale wrote:
> On Tue, Aug 12, 2008 at 02:03:56PM +1000, Toby Corkindale wrote:
> > Hi,
> > I know the Cat cookbook suggests one should use mod_perl only with the
> > preforking MPM.. but I wanted to try with the worker (ie. threaded) MPM 
> > anyway.
> > 
> > DBD-Pg had some thread-safety work done years ago, and I meant to be fine..
> > However I'm seeing errors like this one:
> >   Couldn't render template "undef error - DBD::Pg::db STORE failed:
> >   handle 2 is owned by thread 84e5bf0 not current thread 8fe48f8 (handles 
> > can't
> >   be shared between threads and your driver may need a CLONE method added) 
> > at
> >   /usr/lib/perl5/vendor_perl/5.8.8/DBIx/Class/Storage/DBI.pm line 723.
> > 
> > I've checked, and I am running a recent version of DBD-Pg, that does indeed
> > have the required CLONE function. (Ver 2.8.6)
> > 
> > Are there any known issues with Cat+DBIC+DBD-Pg here? Or maybe I just have
> > screwed something else up..
> 
> Following up on this after some more investigation last night..
> I was previously using DBIx::Class::Schema::Loader. I swapped to a static
> DBIx::Class::Schema setup, and the problem vanished..
> 
> I had a google around for anyone else with this issue, and found a japanese
> site I can't understand which looks to be mentioning it too, including a fix.
> http://d.hatena.ne.jp/holidays-l/20070126/p1

COuld you try the last DBIC dev release?

Also, please can you keep DBIC questions on the DBIC list :)

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] URL Aliasing MyApp::Controller - Apache

2008-08-17 Thread Matt S Trout
On Mon, Aug 11, 2008 at 05:53:46PM +0100, Stephen Shorrock wrote:
> Hi
> 
> I was wondering whether anyone has experience of aliasing the Controllers of
> a Catalyst application within Apache.
> 
> Essentially I would like the Controllers of my Catalyst application to have
> their own alias locations eg.
> 
> MyApp::Controller::Area1 to have a URL http://someserver/area1alias
> and
> MyApp::Controller::Area2 to have a URL http://someserver/area2alias
> 
> Rather than
> 
> http://someserver/myapp/area1
> and
> http://someserver/myapp/area2
> 
> respectively
> 
> My current http.conf file is something like:
> 
> 
>SetHandler perl-script
>PerlHandler MyApp
> 
> 
> and I am able to ModRewrite / Alias so that the actions are handled (eg
> area1app -> /app/myapp/area1).  The problem is that the catalyst object ends
> up with the incorrect $c->base, so that when I generate links using the
> $c->base value they are using the '/myapp/areaX' form rather than
> '/areaXapp' form.

If you're going to insist on using mod_perl anyway, why not just have two
apps and alias each one separately?

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] PageCache and white labelling?

2008-08-17 Thread Matt S Trout
On Wed, Aug 13, 2008 at 02:59:24PM +0800, Martin Ellison wrote:
> I put up the patch several days ago; has anyone looked at it?

Start a thread on catalyst-dev indicating it's got a patch attached if you
want the maintainer to spot it.

Also, config should be under 'Plugin::PageCache' as I said - that's the
standard for plugin config info.

If PageCache is still using old style it'd be nice if you could do a first
patch switching it across.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Model::LDAP vs Authentication::Credential::LDAP

2008-08-17 Thread Matt S Trout
On Mon, Aug 11, 2008 at 11:49:00AM -0500, Peter Karman wrote:
> I am going to be doing something similar eventually using Net::LDAP::Class 
> and either
> C::Model::LDAP or a CatalystX::CRUD::ModelAdapter::LDAP. You might look at
> Net::LDAP::Class to see if it makes what you're doing any easier.

Damn. Net::LDAP::Class reserves ->meta for a crappy metadata object.

Could that not be called metadata or something to make it easier to use
with catamoose?

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Patch for Catalyst-Action-REST-0.63 distro

2008-08-14 Thread Matt S Trout
On Wed, Aug 13, 2008 at 03:16:50PM +0100, Ash Berlin wrote:
> 
> On 13 Aug 2008, at 14:56, Oleg Kostyuk wrote:
> 
> >Hello!
> >
> >I just experienced problems with upgrading Catalyst::Action::REST to  
> >0.63:
> >
> >...
> >*** Module::AutoInstall configuration finished.
> >ERROR: perl: Version 5.008008 is installed, but we need version >= 5.8
> >at inc/Module/Install/Makefile.pm line 172.
> >
> >
> >Following patch fixes this error:
> >
> >tux# diff -u inc/Module/Install/Makefile.pm.orig inc/Module/Install/ 
> >Makefile.pm
> >--- inc/Module/Install/Makefile.pm.orig 2008-08-13  
> >16:39:22.0 +0300
> >+++ inc/Module/Install/Makefile.pm  2008-08-13  
> >16:47:23.0 +0300
> >@@ -170,7 +170,7 @@
> >   }
> >
> >   if ( my $perl_version = $self->perl_version ) {
> >-   eval "use $perl_version; 1"
> >+   eval "use v$perl_version; 1"
> >   or die "ERROR: perl: Version $] is installed, "
> >   . "but we need version >= $perl_version";
> >   }
> >tux#
> >
> >-- 
> >Sincerely yours,
> >Oleg Kostyuk (CUB-UANIC)
> 
> Kudos for the effort of supplying a patch, but everything in the inc  
> directory is auto generated by Module::Install.
> 
> The problem infact lies in Module::Install::Metadata and its  
> perl_version fuction
> 
>  $version =~ s/^(\d+)\.(\d+)\.(\d+)$/sprintf("%d.%03d%03d", 
> $1,$2,$3)/e;
> 
> needs to be
> 
>  $version =~ s/^(\d+)\.(\d+)(?:\.(\d+))?$/sprintf("%d.%03d%03d", 
> $1,$2,$3 || 0)/e;
> 
> I suspect.
> 
> Can you please turn this into a proper diff and submit it as a bug to 
> [EMAIL PROTECTED] then let us know the ticket id so we can 
>  chase it up.

That looks much more sensible. If memory serves, vstrings like that aren't
particularly portable across the different versions of perl M::I supports.

If you can whip up a patch along ash's lines I'll happily apply it to M::I

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] [SOT] cat webmail app?

2008-08-08 Thread Matt S Trout
On Fri, Aug 08, 2008 at 09:39:01AM +0200, Jose Luis Martinez wrote:
> Matt S Trout wrote:
> > We'll happily host a list and svn for this alongside the main catalyst
> > stuff; I can also help you set up an IRC channel on irc.perl.org if you
> > want to at some point.
> 
> Please do so, Matt. That way we can get into discussion without 
> "bothering" the Catalyst list.

I doubt you'd be bothering us so much :)

I'd need a name to make a list though. catalyst-mail-thingy just doesn't seem
great.

So, I suggest you pick one. Otherwise I'm going to come up with a really bad
name like 'camelmail' and name your list after that.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] PageCache and white labelling?

2008-08-08 Thread Matt S Trout
On Fri, Aug 08, 2008 at 05:08:02PM +0800, Martin Ellison wrote:
> But PageCache only works off $c->request->path() ie not the hostname. This
> behaviour is coded in the _get_page_cache_key() subroutine. This means that
> the PageCache serves up the same page content for all websites, irrespective
> of URL, which is not what I want.
> 
> It would be nice if there were some way to fix this and keep using
> PageCache, such as overriding _get_page_cache_key(). Does that make sense?
> eg writing a derived class from PageCache?

How about

__PACKAGE__->config(
  'Plugin::PageCache' => {
key_maker => sub {
  my $c = shift;
  handwave($c);
}
  }
);

and making the current implementation the default in the absence thereof?

Fancy having a play with doing a patch?

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst::Authentication::Credential::LDAP

2008-08-07 Thread Matt S Trout
On Thu, Aug 07, 2008 at 05:29:38PM +0200, Buchan Milne wrote:
> On Thursday 24 July 2008 04:38:30 Matt S Trout wrote:
> > On Wed, Jul 23, 2008 at 08:29:42AM -0500, Peter Karman wrote:
> > > On 07/22/2008 10:37 PM, Matt S Trout wrote:
> > > > On Wed, Jun 25, 2008 at 11:27:13AM -0700, Bruce J Keeler wrote:
> > > >> Also, somewhat apropos, I have a
> > > >> C::A::{Store,Credential}::ActiveDirectory  that I based on the LDAP
> > > >> stuff.  The LDAP modules didn't work for me because they want to bind
> > > >> anonymously and retrieve the crypted password, whereas AD just wants
> > > >> to authenticate with a bind.
> > > >
> > > > So, having established this isn't true.
> > > >
> > > > Could you perhaps instead post a message asking why your config of the
> > > > main LDAP store didn't work so we can figure out what configuration
> > > > problem you had and document it?
> > >
> > > likely he is missing a 'binddn' and 'bindpw' config setting. The initial
> > > bind() will try anonymously if those are not set. What I usually do for
> > > Active Directory is create a user specifically for use with Net::LDAP
> > > (and by extension, C::A::Store::LDAP), and then do all my initial binds
> > > with that user/pass.
> >
> > Hmmm. Should there be an alternative option where (if the user DN is
> > deterministic from the username) it skips the first part and just
> > tries the bind with $generated_dn and $supplied_password (where
> > $generated_dn is the result of a subref/sprintf pattern/whatever
> > supplied in config) ?
> 
> A directory isn't an RDBMS; one should never assume that the naming attribute 
> is the same attribute used for the "username". One should avoid generating 
> DNs 
> in anything but code that initially provisions the entry.

One should be able to get a suitable user provisioned that one uses to do
the initial search.

>From what people seemed to be saying, in the real world this isn't always the
case.

I was suggesting that having such a feature available would permit people
to still use the credential in this case rather than having to write an
entire new one.

Just because you "should avoid" something, sadly, doesn't always mean you
-can- avoid it. Features designed for an imperfect world are important,
although it's also important that they're documented as such and that the
preferred approach is mentioned.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Profiling shows Catalyst::Engine::write slowest ?

2008-08-07 Thread Matt S Trout
On Wed, Aug 06, 2008 at 09:03:35PM -0400, Stef Telford wrote:
> > The question arises, how on earth do I fix/improve these ? From
> > what I assume (dangerous I know), the catalyst engine write is the
> > output from the templating write, how can I improve that speed ? I
> > am using fastcgi on the 'main server' but it's still "as slow".
> > Also the DBD::Pg login could be 'pooled', although I use
> > dbix::class(::schema), has anyone done this ?
> >
> > I am kinda scratching my head on this, any
> > pointers/help/ideas/smacking with manual is appreciated :D Regards
> > Stef
> Hey Everyone,
> Okay, so, colour me stupid, Compess::Gzip helps with the write
> output delivery (because that's mostly down to the network connection
> speed), however, Catalyst and DBIx::Class Pooling/Persistance ? Anyone
> set this up before ?

If you're using Catalyst::Model::DBIC::Schema then the schema instance
is retained so the connection should be persistent - assuming your db
server doesn't kick you off you'll only connect on the first request
per process that hits the db.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] [SOT] cat webmail app?

2008-08-07 Thread Matt S Trout
On Thu, Aug 07, 2008 at 01:12:47PM -0700, Roderick A. Anderson wrote:
> Jose Luis Martinez wrote:
> >Roderick A. Anderson escribió:
> >>I think I've done my due diligence.  I've searched using Google and 
> >>looked through the cat website but haven't found any info on a cat 
> >>based webmail interface.  Heck even Perl based is tough.  And webmail 
> >>may be the wrong term.
> >>
> >You will get free beer ;)
> >
> > From http://dev.catalystframework.org/wiki/catalystbounties
> >
> >4 cases of beer
> >* An IMAP Client using Ajax type things, preferably using Dojo, to 
> >whoop Squirrelmail's butt. Offered by Suretec - ghenry
> >
> >I was planning to start a webmail with Catalyst as the base, and an AJAX 
> >interface myself, but I think it's better to team up than to do it on 
> >myself. Are you open to help? Maybe a mailing list can be started to lay 
> >down the design and necessary components, get ideas, etc.
> 
> This looks a little more energetic than I had planned, at least
> initially.  I am not looking for an Outlook replacement plus I've never
> used Squirrelmail so I don't know what all it provides.

So build the bugger with a plugin interface and let the rest of the world
have a go, you can split the beer :)
 
> That said, I'll give it a whirl.  I need to add that I have specific
> needs as far as IMAP and SMTP (outbound) handling goes.  Those include 
> Postfix, Dovecot, and PostgreSQL.  So that will twist how I want to do 
> things.  I'll aim for as generic as possible so other MTA's, IMAP 
> servers, and LDA's could be used with a little tweaking.

We'll happily host a list and svn for this alongside the main catalyst
stuff; I can also help you set up an IRC channel on irc.perl.org if you
want to at some point.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: question for mst : using $c->config->{blah} ...

2008-08-04 Thread Matt S Trout
On Mon, Aug 04, 2008 at 01:59:06PM +0200, Daniel McBrearty wrote:
> On Mon, Aug 4, 2008 at 11:14 AM, Matt S Trout <[EMAIL PROTECTED]> wrote:
> > On Sun, Aug 03, 2008 at 06:30:02PM +0200, Daniel McBrearty wrote:
> >> wait, it is on $self not $c, so my reservations don't really apply.
> >>
> >> but what about reall config stuff that can change from one
> >> installation to another? then you have to do $c->config->{my_var},
> >> right?
> >
> > How isn't something like connect_info real config?
> >
> 
> By "real config", I mean stuff which is entirely specific to the app,
> and not generic for a particular Cat component. An example might
> something like email addresses that input from a certain form is sent
> to. Maybe "real" wasn't the best word.

You're drawing a line that doesn't exist.

Your DBIC model is specific to your app.

An email address that gets sent to is model or controller config - the
example I showed you is a mailer form app - and the addresses and other
form info get passed to the form manager model.

> In my app, I have done it rather differently - anything that is
> "config" is in the config file - class level or whatever. And
> everything is accessed using $c->config->{whatever}
> 
> The reason I like this is simplicity - if it says "config", I know
> where to find it, end of story. Just a personal preference.

The reason I hate it is that it's a god object.

But if it works for you for the moment, I wouldn't worry too much about it.

Once the app/ctx split stuff comes in you'll probably want to rethink so
you can have multiple copies of your app in the same process.

But until then, I'd strongly recommend against it for new code but I don't
see any business value to going back and changing old code that already
works that way.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: question for mst : using $c->config->{blah} ...

2008-08-04 Thread Matt S Trout
On Sun, Aug 03, 2008 at 06:30:02PM +0200, Daniel McBrearty wrote:
> wait, it is on $self not $c, so my reservations don't really apply.
> 
> but what about reall config stuff that can change from one
> installation to another? then you have to do $c->config->{my_var},
> right?

How isn't something like connect_info real config?

Put the config in a block specific to the model/view/controller that needs
it and access stuff from within that component via $self->{whatever}, for
preference.

$self->config is broken since it only gives you the class level defaults
which is why you should never call it.

$c->config is an acceptable workaround for the fact we don't have a seperate
app object so you can't do $c->app->my_var yet, but you should try and avoid
needing it wherever possible.

My preferred trick is to start off with a config file tailored to how the
user sees it and wrap finalize_config to mangle it into appropriate
components' config - see for e.g.

http://code2.0beta.co.uk/reaction/svn/Reaction-Example-MailerForm/1.000/trunk/lib/MailerForm/ConfigFilter.pm

and

http://code2.0beta.co.uk/reaction/svn/Reaction-Example-MailerForm/1.000/trunk/t/config_filter.t

for some simple mangling code and the end result - example configfile is at

http://code2.0beta.co.uk/reaction/svn/Reaction-Example-MailerForm/1.000/trunk/mailerform.conf

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: Access to $c->cache from a script

2008-08-04 Thread Matt S Trout
On Sun, Aug 03, 2008 at 04:51:54PM -0400, Kevin Old wrote:
> Well, after playing with this for days and not getting anywhere I
> assume it can't be done gracefully.

You tried just patching C::P::Cache, right?

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Checking out sources with svk?

2008-08-03 Thread Matt S Trout
On Sun, Aug 03, 2008 at 07:36:26AM -0700, J. Shirley wrote:
> On Sun, Aug 3, 2008 at 5:17 AM, Matt S Trout <[EMAIL PROTECTED]> wrote:
> > On Sat, Aug 02, 2008 at 06:05:43AM -0700, Dr. Jennifer Nussbaum wrote:
> >> Hi,
> >>
> >> Im trying to check out the Catalyst sources using svk on a Debian system. 
> >> The wiki says that the sources are at 
> >> http://dev.catalystframework.org/svnweb/Catalyst so i took the svk advice 
> >> from the Advent Calender to try to do this:
> >
> > No, the /svnweb/ URL is an SVN::Web human-readable repo view, not something
> > you can point svn/svk at. That's a source -browser-, not a checkout URL.
> >
> >>  $ svk mirror http://dev.catalyst.perl.org/repos/Catalyst //mirror/Catalyst
> >>  $ svk sync -r HEAD //mirror/Catalyst
> >>  $ svk co //mirror/Catalyst
> >>
> >> but in the first line i used 
> >> http://dev.catalystframework.org/svnweb/Catalyst
> >> instead.
> >
> > Which isn't going to work. Follow the -actual- instructions in the Advent
> > Calendar entry without replacing the perfectly working URL it supplies with
> > one that doesn't, please :)
> 
> Unfortunately she's right.
> 
> The Advent says:
>  $ svk mirror http://dev.catalyst.perl.org/repos/Catalyst //mirror/Catalyst
>  $ svk sync -r HEAD //mirror/Catalyst
>  $ svk co //mirror/Catalyst
> 
> Which is what she had, and svk sync -r won't work.

Ah. It appears it's actually 'sync -s'.
 
> The wiki isn't much help, either -- it doesn't give any URL but the svnweb 
> path.

Bleh.

> And the wiki is not emailing me my damn password so I can fix it.

I see emails from the wiki to you sent about half an hour ago to both the
gmail and toeat addresses, which exim logs show were delivered successfully
to the gmail servers.

Quite what google did with it afterwards, I know not. But the wiki -did-
email you your damn password, TYVM.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] 5.80 problem with Catalyst::Model::DBIC::Schema

2008-08-03 Thread Matt S Trout
On Thu, Jul 31, 2008 at 12:00:52AM -0500, Chris Dolan wrote:
> Yep, that error is gone (tested 8171).  The next error I see is:
> 
> [error] Caught exception in engine "Can't use an undefined value as  
> an ARRAY reference at /Users/chris/Work/Catalyst/Catalyst-Runtime/ 
> 5.80/trunk/lib/Catalyst.pm line 1244."
> 
> where line 1244 is:
> push( @{ $c->stack }, $code );
> and "stack" comes from
>has stack => (is => 'rw', default => sub { [] });
> That looks pretty straightforward...
> 
> Email me off-list if I can provide any more helpful information about  
> my environment.

That's ... fucking odd.

Could you make sure you have latest of everything matching qr/^Moose/
and if it persists see if you can post a small example app that explodes
with this error?

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Checking out sources with svk?

2008-08-03 Thread Matt S Trout
On Sat, Aug 02, 2008 at 06:05:43AM -0700, Dr. Jennifer Nussbaum wrote:
> Hi,
> 
> Im trying to check out the Catalyst sources using svk on a Debian system. The 
> wiki says that the sources are at 
> http://dev.catalystframework.org/svnweb/Catalyst so i took the svk advice 
> from the Advent Calender to try to do this:

No, the /svnweb/ URL is an SVN::Web human-readable repo view, not something
you can point svn/svk at. That's a source -browser-, not a checkout URL.
 
>  $ svk mirror http://dev.catalyst.perl.org/repos/Catalyst //mirror/Catalyst
>  $ svk sync -r HEAD //mirror/Catalyst
>  $ svk co //mirror/Catalyst
> 
> but in the first line i used http://dev.catalystframework.org/svnweb/Catalyst
> instead.

Which isn't going to work. Follow the -actual- instructions in the Advent
Calendar entry without replacing the perfectly working URL it supplies with
one that doesn't, please :)

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] transactions with DBIx::Class model

2008-08-02 Thread Matt S Trout
On Sat, Aug 02, 2008 at 06:34:31PM +0200, Ansgar Burchardt wrote:
> Hi,
> 
> I am using Catalyst with a DBIx::Class model (via C::M::DBIC::Schema)
> and want to do serveral database updates in a transaction.  To do this I
> need the schema object to call $schema->txn_do($whatever).
> 
> The C::M::DBIC::Schema documentation says that I should be able to
> access the schema object via $c->model("MyApp::Something")->schema, but
> if I do so I get the following error:
> 
> Can't locate object method "schema" via package
> "DBIx::Class::ResultSet"

Assuming MyApp::Model::MyApp is your DBIC::Schema model

$c->model('MyApp')->schema;

is what you want.

$c->model('MyApp::Foo')

is just a shortcut for

$c->model('MyApp')->schema->resultset('Foo')

If you only have a $row or a $rw, then

$obj->result_source->schema

will get you back to the schema.

For more information, read the DBIx::Class::ResultSet, ::ResultSource,
::Schema and ::Row docs, plus the docs for Catalyst::Model::DBIC::Schema
itself.

Please also note that dbix-class has its own list so any more DBIC-specific
questions should go there.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Weak references - perl error

2008-08-02 Thread Matt S Trout
On Fri, Aug 01, 2008 at 05:16:59PM +0100, Dermot wrote:
> Now I am getting the following error:
> 
> Weak references are not implemented in the version of perl at
> /usr/lib/perl5/site_perl/5.8.8/Catalyst.pm line 24

perl -MCPAN -e 'force("install Scalar::Util");'

will fix it. They've managed to ship a non-XS Scalar::Util. Again.

Red Hat fuck this up in their perls on a regular basis (though I've seen
both debian and gentoo manage it on occasion as well).

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Configuring a Controller from the config file

2008-07-31 Thread Matt S Trout
On Wed, Jul 30, 2008 at 01:38:00PM +0200, Moritz Onken wrote:
> Hi,
> 
> I tried to set some config options for a controller with the config  
> file.
> 
> YAML-code:
> 
> ---
> name: MyApp
> 
> Controller::Root:
>   key: value
> 
> I'm using ConfigLoader and the debug shows that it successfully loaded  
> the yaml file.
> In a method in my Root controller I tried to access those config  
> options via $self->config.

Which contains the class-level defaults.

Not application defaults.

You should never, ever EVER access $self->config in a model, view or
controller object.

Your config value will be in $self->{key}.

It's considered normal to do

package My::Controller::Foo;

use strict;
use warnings;
use parent qw(Catalyst::Controller);

__PACKAGE__->mk_accessors(qw(foo bar));

__PACKAGE__->config(
  foo => 'default_for_foo',
  bae => { default => 'for_bar' },
);

then later in your code just call $self->foo to get the runtime value.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Squatting::On::Catalyst

2008-07-31 Thread Matt S Trout
On Wed, Jul 30, 2008 at 12:02:08PM +0100, Ash Berlin wrote:
> 
> On 30 Jul 2008, at 02:27, John Beppu wrote:
> 
> >
> >
> >On Tue, Jul 29, 2008 at 5:21 AM, Daniel McBrearty 
> ><[EMAIL PROTECTED] > wrote:
> >my 0.05 (possibly a bit OT) :
> >
> >Off-topic or not, I think these are interesting and valid questions.
> >
> >I looked previously at a few ways of adding forums etc to the site
> >using 3rd party code, indeed there are many possibilites (some perl,
> >some not)
> >
> >The thing that was always a sticker for me was getting some kind of
> >logical integration, ie:
> >
> >1. letting users keep existing member and login creds
> >
> >Now that composition and embedding of web apps is becoming a  
> >reality, we have to start anticipating needs like this.  For  
> >example, the documentation for an app that's built to be embedded  
> >could state that:
> >It expects a user object to be in its session's "u" key.
> >The app will expect to be able to call the ->name method on this  
> >user object.  (Some apps may want more...  others less...  this is  
> >just a hypothetical example.)
> >If that key is undef, the app will assume the current session is not  
> >in a "logged in" state.
> > I think being up-front about login policy would be enough to share  
> >users across multiple web apps joined together as one cohesive unit.
> 
> 
> I dont. Lets take the example of embedding a forum. It will most  
> likely store its data in a DB of its own design. It will also quite  
> likely have its own user table, and have FKs referencing that  
> table see the problem? There's more to sharing users than just  
> logging.
> 
> I can't really see any way around that other than on a case-by-case  
> basis sadly. Someone please feel free to correct me.

Assume all apps use (uid, username, password).

Then if they're all also using DBIC, it's fairly easy. Each "sub-app" uses
the same credential and a store that maps to -its- user class.

We need to have attribute names and column names truly separated though,
which means DBIC 09 most likely.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Duplicate entries with C::P::Session::Store::DBIC and MySQL

2008-07-30 Thread Matt S Trout
On Tue, Jul 29, 2008 at 12:49:17PM +0200, Tobias Kremer wrote:
> Quoting Tobias Kremer <[EMAIL PROTECTED]>:
> > However, I'm unsure how to detect if the error really was a duplicate entry
> > error or something else.
> >   die $@ if $@ && $@ !~ /duplicate/i;
> > This doesn't work because different DBs throw different errors.
> 
> Also, flash() is supposed to always return a flash entry. So in case of a
> duplicate error we'd have to do another find(). That'd be 3 queries in the
> worst case.
> 
> Maybe it'd be better to ditch find_or_create in favor of something like this:
> 
> eval {
>   $row = $self->model->create( { ... } );
> }
> if( $@ && $@ =~ /duplicate/ ) { # the question about detecting this remains
>   $row = $self->model->find( { ... } );
> }
> 
> This would reduce the query to 1 at best and 2 at worst. On the other hand, I
> fear that it's still possible that the find() doesn't actually find a row
> because it was deleted in the meantime by the other request :(

It's still probably viable.

What I'd really like is to add some code to DBIC's storage to know what re
that /duplicate/ is on whatever DB so we can bury this away from the user
and DBIC can Just Use It for find_or_create on any supported database.

Maybe you could wander over to the DBIC list and poke at patching that
instead?

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Squatting::On::Catalyst

2008-07-30 Thread Matt S Trout
On Tue, Jul 29, 2008 at 02:08:21PM +0100, Chisel Wright wrote:
> On Tue, Jul 29, 2008 at 02:21:10PM +0200, Daniel McBrearty wrote:
> > 1. letting users keep existing member and login creds
> > 2. being able to cross ref to other parts of the site eg. for a
> > certain node, easily have a "discussion" link, and the reverse link
> > from the forum
> 
> If you ever think of a good way of doing this, please let me know!

Starter for 10.


  discussion_controller MyForum::Thread
  discussion_action view
  discussion_field  thread_id


$c->uri_for(
  $c->controller($self->discussion_controller)
->action_for($self->discussion_action),
  [ $current_page->id ]
);

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Squatting::On::Catalyst

2008-07-29 Thread Matt S Trout
On Mon, Jul 28, 2008 at 09:36:44PM -0700, John Beppu wrote:
> On Mon, Jul 28, 2008 at 2:40 PM, Matt S Trout <[EMAIL PROTECTED]>wrote:
> 
> > On Mon, Jul 28, 2008 at 08:27:27AM -0700, John Beppu wrote:
> >
> >
> > > Imagine if you could install a blog, a wiki, a forum, or a store just as
> > > easily.
> >
> > Yeah, we'll be doing that for arbitrary Catalyst components for 5.80,
> > I hope. This is still really cool, mind.
> >
> 
> Good luck w/ that.  I don't know the guts of Catalyst too well, but I have a
> feeling it could be tricky.

Most interesting features are at least somewhat tricky.

Anyway, non-tricky code is boring to write :)

> In the meantime, please have a look at the HTTP::Engine project so that
> > you can share HTTP code with other frameworks, and consider joining the
> > catalyst-dev list since we're planning to kick off a project to see about
> > sharing dispatchers with other projects as well.
> >
> 
> HTTP::Engine was exactly what I needed when I started the project.  I'm glad
> I know about it, now.

Please do pop onto irc.perl.org#http-engine if you need to suggest anything
to the devs - they're very happy to hear wishlist stuff from potential users.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Squatting::On::Catalyst

2008-07-28 Thread Matt S Trout
On Mon, Jul 28, 2008 at 08:27:27AM -0700, John Beppu wrote:
> *Squatting::On::Catalyst*
> 
> Squatting is a web microframework for Perl that's based on Camping from the
> Ruby world.  During the transition from Ruby to Perl, Squatting gained some
> mutant powers which is why I'm writing to you today.
> 
> One of Squatting's mutant powers is its ability to embed itself into other
> frameworks (like Catalyst).  You can take whole Squatting apps, and embed
> them into your existing web application with just a few lines of glue code.
> Allow me to demonstrate.

Assuming Squatting supports CGI, Catalyst::Controlle::WrapCGI enabled this
already. Your code is almost certainly more efficient though.

> *What Are The Implications of This?*
> 
> Right now, anyone who is developing a web app with Catalyst can install
> Pod::Server from CPAN and embed it directly into their web app.  However,
> this is just the beginning.
> 
> Imagine if you could install a blog, a wiki, a forum, or a store just as
> easily.

Yeah, we'll be doing that for arbitrary Catalyst components for 5.80,
I hope. This is still really cool, mind.

In the meantime, please have a look at the HTTP::Engine project so that
you can share HTTP code with other frameworks, and consider joining the
catalyst-dev list since we're planning to kick off a project to see about
sharing dispatchers with other projects as well.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Duplicate entries with C::P::Session::Store::DBIC and MySQL

2008-07-28 Thread Matt S Trout
On Mon, Jul 28, 2008 at 01:03:52PM +0200, Tobias Kremer wrote:
> Hi list,
> 
> I've written about this at least once in the past and still haven't been able 
> to
> figure out a proper solution to the problem.
> 
> We're getting loads (up to 30-40 per day) of the following fatal error:
> 
> Duplicate entry 'flash:***' for key 1 [for Statement "INSERT INTO sessions2 
> (id)
> VALUES (?)" with ParamValues: 0='flash:***'] at
> /usr/local/lib/perl5/site_perl/5.8.8/Catalyst/Plugin/Session/Store/DBIC/Delegate.pm
> line 52"
> 
> I suppose that most of you are never seeing this error because you're using
> 
> a) a sane database with proper transactions (although I'm
>unsure DBICs find_or_create makes use of them transparently). I'm
>(at least for the moment) stuck with MySQL and a MyISAM session table.
>Yeah, I know ...
> 
> b) a storage backend that doesn't bother if there are duplicate
>entries (FastMmap, Memcached, File, etc) and just overwrites.
> 
> The cause obviously seems to be concurrent requests by the same user - mostly
> the impatient "F5-hitter"-type :)) So what happens is basically:
> 
> 1) Request 1 comes in, selects for a flash-entry in the
>session table and doesn't find anything.
> 
> 2) Request 2 comes in, does the same and comes back with empty hands, too.
> 
> 3) Request 1 inserts its flash values into the table.
> 
> 4) Request 2 tries to do the same, fails and the user gets a fatal error 
> message
> although nothing _that_ bad happened :(
> 
> Now, I know that the time window for this to happen is supposed to be quite
> small but the amount of errors I'm getting is worrying. So, IMHO the error
> should be handled by the application in a more gentle way (as opposed to
> throwing a fatal error) because AFAICT nothing bad will happen if the session
> data is just overwritten (which is what most other P::Session backends will do
> anyway).
> 
> Is there anything speaking against wrapping line 52 of the DBIC backend class
> with an eval to trap this duplicate error and ignore it silently (or just warn
> about it) except the fact that it's trying to fix something that probably
> should be the database's task?

Don't see why not.

The interesting question i how we make a test for it.

Mm ... ah. How about a debugcb sub that checks for the SELECT and does the
insert in the background so the row's there when the DBIC-driven INSERT
happens?

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] API Versioning for Web Services

2008-07-28 Thread Matt S Trout
On Sun, Jul 27, 2008 at 09:09:46AM -0700, Bill Moseley wrote:
> On Sat, Jul 26, 2008 at 06:00:39AM +0100, Matt S Trout wrote:
> > 
> > sub widget :Local VersionedXMLRPC('widget.get') {
> > 
> > sub widget_xmlrpc_v1 {
> > 
> > have VersionedXMLRPC apply a custom a ction class that does ->can
> > based dispatch, same way Catalyst::Action::REST does.
> 
> C::Action::REST uses "ActionClass('REST')" to specify the class for
> the action.  And with a custom request class, has a custom dispatcher to
> dispatch based on the request method.
> 
> Your example above does not use ActionClass.  Were you suggesting that
> these XMLRPC actions have their own action class, and if so how would
> the actions be setup then?

My example suggests you write _parse_VersionedXMLRPC_attr to apply
the action class etc.
 
> By the way, my assumption is I would have the entire XMLRPC API
> versioned.  I asked about this on the XMLRPC list and it was
> recommended that instead I version individual methods.  That is, have
> separate method names that include a version:
> 
> widget.1.get
> widget.2.get
> etc.
> 
> which would make the Catalyst part very simple, but I'm not sure I
> like that idea of each method having a version in the method name.

I'd suggest a header, really. X-MyApp-XMLRPC-Api-Version: or similar.

Makes the versioning stuff optional, thus simplifying the simple case.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] API Versioning for Web Services

2008-07-25 Thread Matt S Trout
On Fri, Jul 25, 2008 at 07:09:58AM -0700, Bill Moseley wrote:
> 
> I'm looking for suggestions how to best support multiple API versions
> in an application.
> 
> The API and web share many controller actions.  As is not uncommon,
> actions available for the API are defined with an attribute:
> 
> sub foo : Local XMLRPC( 'foo.get' ) {
> 
> This is great for sharing code as often the API just exposes
> the same functionality as the web interface.
> 
> 
> When a new version of the web application is released then all web
> users see the new version at the same time.  If an action in the new
> version expects an additional new parameter then the form posting to
> that action is modified at the same time.
> 
> But, the API access to an application typically needs to be backward
> compatible to allow API users time to update their client applications
> with the newer requirements.
> 
> So, it seems I would need multiple controller actions that are
> dispatched based on some version.
> 
> 
> Here's one idea I was kicking around:
> 
> Say I have an existing controller action that is used by the web
> users, but also available as an XMLRPC API method:
> 
> sub widget : Local XMLRPC( 'widget.get' ) {
> 
> So in a new application version that controller action is changed
> and now requires a new parameter and returns new data.
> 
> In the new version I want to support the new action but remain
> backward compatible.
> 
> # fetch widget for web and API
> sub widget : Local XMLRPC( 'widget.get' ) Version( 2 ) {
> 
> # deprecated to support old version of API
> sub widget_old : XMLRPC( 'widget.get' ) Version( 1 ) {

sub widget :Local VersionedXMLRPC('widget.get') {

sub widget_xmlrpc_v1 {

have VersionedXMLRPC apply a custom a ction class that does ->can
based dispatch, same way Catalyst::Action::REST does.

Could even make XMLRPC always do that in your app, you'll need
a controller base class to provide the _parse_AttrName method
iether way.

Seems like a bit less typing without any real loss of precision
- the main action should likely fire for any version not explicitly
handled for compat so no version given or a compatible newer version
just happen.

If you're going to assume integer versions (or some method name valid
encoding of a more complex version number) you could probably instead
have the action class scan the controller's entire namespace on
creation with a view to making _v9 handle anything below v9 as well
until it finds a more specific, lower versioned compat handler (_v3
or similar).

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Using a post argument in a template

2008-07-25 Thread Matt S Trout
On Fri, Jul 25, 2008 at 10:02:47AM -0500, James S. White wrote:
> nevermind. this works. I am an idiot. It helps if the array isn't empty...

The odds of discovering that just after you hit send go up in direct
proportion to the number of people you're about to make a fool of yourself
in front of.

This is a 700-odd member list. This is both good and bad when taken with the
above truism.
 
> On Fri, 25 Jul 2008, James S. White wrote:
> 
> > I can stash and array and when I use [% c.stash.mylist %] in the template,
> > it prints 'ARRAY(0x94023b0)' but if I try:
> >
> > [% FOREACH element IN c.stash.mylist %]

[% FOREACH element IN mylist %]

General rule of thumb: if you find yourself writing "c." in a template,
stop and ask yourself if it shouldn't have been done already and stashed
for you.

> > [% element %]
> > [% END %]

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Preventing simultaneous logins

2008-07-25 Thread Matt S Trout
On Fri, Jul 25, 2008 at 10:27:34AM +0200, Daniel McBrearty wrote:
> >>
> >> 1. checking whether there is an existing session associated this username
> >
> > Session::PerUser ?
> >
> 
> I looked briefly at this, but I'm a bit wary because
> C::P::Session::Store::Fastmmap warns against being used with it. What
> is PerUser doing that is special in that respect, and what is a good
> backend for it?
> 
> REading the docs for it, it seems like something slightly different -
> keeping the same session in place, even if the user logs in in the
> middle of it, if I understand correctly?

You want:

login from elsewhere to log out the same user anywhere else

It wants:

any login by the same user "claims" the user's session

so, if you add in your root auto

if ($c->user_exists) {
  unless ($c->user_session->{sid} eq $c->sessionid) {
$c->logout;
$c->forward('/auth/logged_out');
return 0;
  }
}

and in MyApp

sub set_authenticated {
  my $self = shift;
  $self->next::method(@_);
  $self->user_session->{sid} = $self->sessionid;
}

then you should pretty much be done.

So far as I can tell, this is perfect for you. You just sometimes get
persistent session data as well (it warns against fastmmap because in the
"persistent session" use case fastmmap is lossy - in yours the lossyness
is irrelevant, you don't care about the persistence feature)

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] auto re-load of application yaml config file?

2008-07-23 Thread Matt S Trout
On Wed, Jul 23, 2008 at 11:26:18PM +0100, Pedro Melo wrote:
> 
> On Jul 23, 2008, at 4:32 AM, Matt S Trout wrote:
> 
> >On Tue, Jul 22, 2008 at 12:53:10PM +0200, Marc Sebastian Pelzer wrote:
> >>Hello,
> >>
> >>I'm running a Catalyst application under mod_perl and wonder if there
> >>is a Plugin available that detects changes on the main
> >>application .yml config file and does a automatic re-load if needed?
> >>It not - what would be the most elegant (and less I/O intensive) way
> >>of doing this? Would it be enough to do a
> >>
> >>__PACKAGE__->config( 'Plugin::ConfigLoader' => { file =>
> >>'my_config.yml' } );
> >>in my Root controller when I detect a change?
> >
> >Nope. apache2ctl restart, minimum.
> >
> >You may find external FastCGI and a handler swap is a better approach.
> 
> Or mod_perl backends (old and new) and a decent load balancer like  
> perlbal.

Same approach. Different technologies.

I find getting two FastCGI handlers running much less of a pain in the
arse than getting two mod_perl instances running - the distro stuff tends
to get in the way and even once I've beaten it out of the way it's much
more work than FCGI.

But sure, either is good. Choose your poison according to your own tastes :)

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst::Authentication::Credential::LDAP

2008-07-23 Thread Matt S Trout
On Wed, Jul 23, 2008 at 08:29:42AM -0500, Peter Karman wrote:
> 
> 
> On 07/22/2008 10:37 PM, Matt S Trout wrote:
> > On Wed, Jun 25, 2008 at 11:27:13AM -0700, Bruce J Keeler wrote:
> >> Also, somewhat apropos, I have a 
> >> C::A::{Store,Credential}::ActiveDirectory  that I based on the LDAP 
> >> stuff.  The LDAP modules didn't work for me because they want to bind 
> >> anonymously and retrieve the crypted password, whereas AD just wants to 
> >> authenticate with a bind.
> > 
> > So, having established this isn't true.
> > 
> > Could you perhaps instead post a message asking why your config of the
> > main LDAP store didn't work so we can figure out what configuration problem
> > you had and document it?
> 
> likely he is missing a 'binddn' and 'bindpw' config setting. The initial 
> bind() will try
> anonymously if those are not set. What I usually do for Active Directory is 
> create a user
> specifically for use with Net::LDAP (and by extension, C::A::Store::LDAP), 
> and then do all
> my initial binds with that user/pass.

Hmmm. Should there be an alternative option where (if the user DN is
deterministic from the username) it skips the first part and just
tries the bind with $generated_dn and $supplied_password (where
$generated_dn is the result of a subref/sprintf pattern/whatever
supplied in config) ?

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst and Taint?

2008-07-23 Thread Matt S Trout
On Tue, Jul 22, 2008 at 11:45:09PM -0700, Chris Weyl wrote:
> On Tue, Jul 22, 2008 at 8:30 PM, Matt S Trout <[EMAIL PROTECTED]> wrote:
> > On Mon, Jul 21, 2008 at 10:08:11PM -0700, Chris Weyl wrote:
> >> Hey all --
> >>
> >> A google of "catalyst taint" turns up this message:
> >>
> >> http://lists.scsys.co.uk/pipermail/catalyst/2005-December/004007.html
> >>
> >> It doesn't look like there has been a release of
> >> Module::Pluggable::Fast since then.  Does anyone know where this patch
> >> lurks? :-)  (Assuming, of course, that this is still the right path to
> >> work down.)
> >
> > We don't even use Module::Pluggable::Fast anymore. Catalyst went back to
> > a refactored plain Module::Pluggable instead for 5.70+. Hopefully the
> > patch claco sent back then got applied somewhere in the meantime.
> >
> > Before caring about a three year old message, first check the module
> > it refers to is even involved anymore :)
> 
> I'll keep that in mind :)
> 
> According to CPAN, Module::Pluggable::Fast hasn't been updated since
> 16 Dec 2005, about 2 weeks before that email was sent If it was
> applied, I rather suspect it wasn't there.

Yeah, thought so. And it's fucking horrible code, so when sri abandoned
it none of us wanted to maintain it.

So I talked muttley into refactoring Module::Pluggable for us instead :)
 
> > (and since you're the only person since to mention taint mode, I don't
> > think most people care about it - I certainly don't see it being very
> > useful for Catalyst code, maybe you could enlighten us as to why you
> > do?)
> 
> Taint mode would seem to be a good way to help protect against
> accidental exposures, especially in internet-facing apps.  I was
> curious to see what would happen if I tried running an instance with
> -T...  Admittedly, I'm more of a newbie Catalyst user than internals
> person by any measure, but is there something about Catalyst that
> renders taint unnecessary, or moot? ...or obsolete? ...or more of a
> pain than it's worth?

Taint mode just separates "stuff that came from outside the app" and
"stuff from inside the app". The thing is, by the time you get to a $c->req
object parsing has happened so it probably won't be tainted anyway. But
you -do- still need to validate it. So the only thing I can see taint mode
providing is a false sense of security. But "probably" is not the same
as "definitely" and if that turns out to be wrong my entire argument is
bollocks. Bear this in mind :)

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Preventing simultaneous logins

2008-07-23 Thread Matt S Trout
On Wed, Jul 23, 2008 at 09:47:57PM +0200, Daniel McBrearty wrote:
> I'm using Cat with a pretty standard configuration of :
> 
> Catalyst::Plugin::Authentication
> Catalyst::Plugin::Session
> Catalyst::Plugin::Session::State::Cookie
> Catalyst::Plugin::Session::Store::FastMmap
> 
> to handle login and session management. My login code looks like this:
> 
>  my $u = $params->{username};
> 
>   if ($c->authenticate( { username => $u,
>   password => $params->{'password'}
> } )){
> my $user = $c->user;
> $user->last_login(DateTime->now);
> $user->update();
> $c->response->redirect( $forward, 301);
> 
>   } else {
> # login failed
> $c->stash->{login_failed} = 1;
>   }
> 
> 
> What I'd like to do is check if this user is already logged in at some
> other computer, and deny access if so. I guess that means :
> 
> 1. checking whether there is an existing session associated this username

Session::PerUser ?

> 2. Being sure that the associated session is cleared when the user hits 
> 'logout'

after logout => { shift->delete_session };

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst::Authentication::Credential::LDAP

2008-07-22 Thread Matt S Trout
On Wed, Jun 25, 2008 at 11:27:13AM -0700, Bruce J Keeler wrote:
> Also, somewhat apropos, I have a 
> C::A::{Store,Credential}::ActiveDirectory  that I based on the LDAP 
> stuff.  The LDAP modules didn't work for me because they want to bind 
> anonymously and retrieve the crypted password, whereas AD just wants to 
> authenticate with a bind.

So, having established this isn't true.

Could you perhaps instead post a message asking why your config of the
main LDAP store didn't work so we can figure out what configuration problem
you had and document it?

Awesome though it is that you wrote a store and credential, I'd rather the
next person wrote one that didn't already exist :)

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] auto re-load of application yaml config file?

2008-07-22 Thread Matt S Trout
On Tue, Jul 22, 2008 at 12:53:10PM +0200, Marc Sebastian Pelzer wrote:
> Hello,
> 
> I'm running a Catalyst application under mod_perl and wonder if there  
> is a Plugin available that detects changes on the main  
> application .yml config file and does a automatic re-load if needed?  
> It not - what would be the most elegant (and less I/O intensive) way  
> of doing this? Would it be enough to do a
> 
> __PACKAGE__->config( 'Plugin::ConfigLoader' => { file =>  
> 'my_config.yml' } );
> in my Root controller when I detect a change? 

Nope. apache2ctl restart, minimum.

You may find external FastCGI and a handler swap is a better approach.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst and Taint?

2008-07-22 Thread Matt S Trout
On Mon, Jul 21, 2008 at 10:08:11PM -0700, Chris Weyl wrote:
> Hey all --
> 
> A google of "catalyst taint" turns up this message:
> 
> http://lists.scsys.co.uk/pipermail/catalyst/2005-December/004007.html
> 
> It doesn't look like there has been a release of
> Module::Pluggable::Fast since then.  Does anyone know where this patch
> lurks? :-)  (Assuming, of course, that this is still the right path to
> work down.)

We don't even use Module::Pluggable::Fast anymore. Catalyst went back to
a refactored plain Module::Pluggable instead for 5.70+. Hopefully the
patch claco sent back then got applied somewhere in the meantime.

Before caring about a three year old message, first check the module
it refers to is even involved anymore :)

(and since you're the only person since to mention taint mode, I don't
think most people care about it - I certainly don't see it being very
useful for Catalyst code, maybe you could enlighten us as to why you
do?)

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst-Devel Patch

2008-07-21 Thread Matt S Trout
On Sun, Jul 20, 2008 at 08:42:26AM -0500, Todd Rinaldo wrote:
> Hi, yesterday, I asked a question in DBIC channel about how
> Catalyst::Helper auto-produces schema. It was answered with purl:
> make_schema_at. I suggest this be put in Catalyst::Helper so people
> can more easily find the answer

I suggested you patched Catalyst::Helper::Model::DBIC::Schema

... maybe we should have a myapp_create.pl --help Model DBIC::Schema
option that invokes perldoc for the appropriate helper?

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] [Announce] Catalyst-Runtime 5.7099_01 - Developer Release

2008-07-21 Thread Matt S Trout
On Mon, Jul 21, 2008 at 07:13:37AM -0400, Charles Bailey wrote:
> Agreed.  I've had it on TODO for the past two weeks, but getting
> hammered at dayjob. Will try to do this week.

We're one more dev release short of shipping. Please try because otherwise
it'll probably have to wait until 5.80

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst::Authentication::Credential::LDAP

2008-07-21 Thread Matt S Trout
On Mon, Jul 21, 2008 at 11:48:39AM -0500, [EMAIL PROTECTED] wrote:
> Matt S Trout <[EMAIL PROTECTED]> wrote on 07/19/2008 07:10:28 PM:
> 
> > On Wed, Jun 25, 2008 at 11:27:13AM -0700, Bruce J Keeler wrote:
> > > Also, somewhat apropos, I have a
> > > C::A::{Store,Credential}::ActiveDirectory  that I based on the LDAP
> > > stuff.  The LDAP modules didn't work for me because they want to bind
> > > anonymously and retrieve the crypted password, whereas AD just wants to
> 
> > > authenticate with a bind.  My stuff also gets role information from AD
> > > groups.  I've been meaning to get it out on CPAN one of these days, but
> 
> > > it hasn't been a priority; I suppose I can work on it if anyone else
> > > needs it though.
> >
> > Sounds to me like 'auth by bind' versus 'auth by retrieve and check'
> should
> > be an option in the LDAP stuff, not a separate module. Fancy doing up
> > a patch?
> >
> 
> >From the POD It authenticates users in two steps:
> 
> 
> 
> 1) A search of the directory is performed, looking for a user object that
> 
>matches the username you pass.  This is done with the bind credentials
> 
>supplied in the "binddn" and "bindpw" configuration options.
> 
> 
> 
> 2) If that object is found, we then re-bind to the directory as that
> object.
> 
>Assuming this is successful, the user is Authenticated.
> 
> 
> 
> 
> 
> 
> 
> And the actual check password code:
> 
> $self->store->ldap_bind( undef, $self->ldap_entry->dn, $password,
> 
> 'forauth' );
> 
> Notice the rebind.
> 
> So it does not try to "retrieve the crypted password",  it does bind (anon
> or by authorized service account if set in binddn and bindpw) to the ldap
> server, Next it grabs the user's dn from a search on that bind.  Finally to
> authenticate it actually binds to the ldap server as that user's dn.  This
> works well against AD (I use it),  I don't understand what deficiency you
> are trying to fix with your patch.

Maybe the search phase failed for the original poster?

I dunno, I was just saying it should probably support both approaches :)

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Note: Mail backlog cleared, please re-send if I've missed anything

2008-07-19 Thread Matt S Trout
So, I just nailed through another fucking huge mail backlog because I suck
at keeping on top of it.

And if you sent something between the last time I was on-list and the first
message I replied to, it probably got eaten if the "too old to matter now,
hopefully" cull.

So, if there was such a thing, or you've had patches dropped on the floor,
or whatever, please send it again either to mst - shadowcat.co.uk for stuff
you don't think is going to need a list reply or the appropriate list if
not (as a new thread, this is cross-posted so replies are -bad-, mmkay?).

Yours, wondering if he'll finally figure out a lists setup he doesn't suck
at, mst.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Graceful handling of database failure

2008-07-19 Thread Matt S Trout
On Wed, Jul 16, 2008 at 12:57:58PM -0500, mike wrote:
> On Tue, Jun 17, 2008 at 5:27 PM, J. Shirley <[EMAIL PROTECTED]> wrote:
> > On Tue, Jun 17, 2008 at 2:31 PM, Mitchell K. Jackson
> > <[EMAIL PROTECTED]> wrote:
> >> Good afternoon,
> >>
> >> Is there a graceful way for a catalyst app to handle when the database
> >> server goes away?  If this happens while a process is holding open a
> >> database connection it's already been using, there's not even a
> >> database error to the log. The only error is "read data timeout in 40
> >> seconds", and an error 500 to the web browser.
> >>
> >> I would like my app to be able to deliver a  more useful error to the
> >> end user, such as "Lost database connection."  If I can retain control
> >> of the app in this event, I'll have it send me an sms for good
> >> measure.  Any ideas how I could go about this?
> >>
> >> Regards,
> >>
> >> /Mitchell K. Jackson
> >>
> >
> >
> > That's really up to the model you are using.  Catalyst doesn't handle
> > databases :)
> >
> > If you are using DBIx::Class, I'd be surprised if it doesn't do the
> > right thing already.
> >
> > As far as catching the error, make sure that your model throws a
> > proper exception and you can catch that in the end action.
> >
> > Something like this is what I tend to use:
> 
> [snip]
> 
> are you using Catalyst::Plugin::Session::Store::DBIC like he is?  we're
> using code identical to what you suggested, but it doesn't work for
> exceptions generated in finalize_headers.

I think that the exception thrown by the session store should be considered
a bug.

Or at least the whole "exception in engine BLAM" result.

Not entirely sure what the best way is of fixing it though - anybody got
any ideas?

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] why no $c->action_class ?

2008-07-19 Thread Matt S Trout
On Wed, Jul 16, 2008 at 03:47:43PM +0200, Dami Laurent (PJ) wrote:
> Hi all,
> 
> Catalyst lets users build their own base classes for Request, Response,
> Dispatcher , etc. (cf. methods $c->request_class, $c->dispatcher_class,
> etc.).
> 
> Question : why is there no such mechanism for setting my own base class
> for Action ?
> 
> I found a way to do it as follows :
> 
> package My::App::Base::Controller;
> use My::App::Base::Action;
>__PACKAGE__->_action_class('My::App::Base::Action');
> 
> Another way would be to override the "register_actions" and/or
> "create_action" method in My::App::Base::Controller.
> 
> However, both ways make me fell a bit uncomfortable because they rely on
> Catalyst internals, not on any public API.
> 
> I know that there is a way to set action classes on a per-method basis,
> by using the :ActionClass attribute, but it would be tedious to do this
> on every method of every Controller. Furthermore, I want to keep the
> :ActionClass mechanism for specific cases where I need a specific
> subclass of My::App::Base::Action.
> 
> So, coming back to my question : is there any good reason why we don't
> have a $c->action_class method in Catalyst ?

Yes. It's per-controller. The two methods you already described are
correct. _action_class is _prefixed to indicate it shouldn't be called
from outside the class, not that you shouldn't override it.

register_actions and create_action are both not prefixed because they're
not only meant to be wrapped but callable from outside the object.

If you feel that this isn't clear, a doc patch would be much appreciated.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Package , Catalyst::Plugin::Wizard is great but examples need some clarification

2008-07-19 Thread Matt S Trout
On Fri, Jul 11, 2008 at 04:50:08PM +1000, [EMAIL PROTECTED] wrote:
> 
> hi there
>  
> Anyone used this module yet? I was very impressed when i read the
> perldoc for it.
>  Even got it installed. 
> I  think it's a very powerful module but needs some work.

First, it needs a rewrite as a controller base class.

We established with the various form plugins that a $self->form was much
better than $c->form (no clashes between plugins, better control of form
scoping etc.).

This use case is no different. I'd recommend not using it at the moment
since the author clearly isn't aware of best practices.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] parameter validation

2008-07-19 Thread Matt S Trout
On Wed, Jul 02, 2008 at 11:08:46PM +0100, Caroline Johnston wrote:
> Hi,
> 
> This isn't strictly a catalyst question, but it arose from a previous
> thread,
> http://lists.scsys.co.uk/pipermail/catalyst/2007-December/016329.html, on
> parameter validation and the problems of code like
> 
>   my $user = $rs->create({ 
>   is_admin => 0,
>   username => $c->req->param('username'), 
>   });
> 
> 
> I'm using Data::FormValidator. If I have a DFV constraint on fields that 
> shouldn't be multi-valued, something like:
> 
> sub is_single{
> my $c = shift;
> return sub{
>   my $dfv = shift;
>   $dfv->name_this('is_single');
>   my $field = $dfv->get_current_constraint_field;
>   my $data = $dfv->get_filtered_data;
> my $test = $data->{$field};
>   return ref $test ? 0:1;
> }
> }
> 
> should that allow me to use validated parameters in hashes with impunity
> or am I missing the point of the problem?

The point of that message was that $c->req->param('foo') is list context
aware whereas $c->req->params->{foo} isn't.

But once you've done the validating, you're going to be ok either way.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Accessing schema in non-DBIC-model

2008-07-19 Thread Matt S Trout
On Tue, Jul 01, 2008 at 02:49:37PM +0200, Tobias Kremer wrote:
> I'm using Catalyst::Model::DBIC::Schema to make my DBIC schema available as
> model in my Catalyst application. Now I'd like to create a custom model (e.g.
> MyApp::Model::Custom) which during the server start fetches and calculates 
> some
> stuff from the database via my DBIC schema and keeps it in the object to speed
> up retrieval in my Cat app. I want to do:
> 
> my $rs = $c->model( 'Custom' )->find_by_foo( $foo )
> 
> and get back a (e.g. MyApp::Schema::Foo) ResultSet with stuff fetched during
> server start that fits the condition $foo.
> 
> My problem is that I can't think of an elegant way to access the initialized
> schema from within the models new or COMPONENT method (which is called during
> server start when the model is set up). I tried this:
> 
> sub COMPONENT {
> my( $class, $app, $args ) = @_;
> $app->model( 'Schema::Foo' )->result_source->schema ...
> }
> 
> But, of course, $app->model('Schema::Foo') isn't fully initialized at that 
> time.
> 
> Any hint is greatly appreciated!

Catalyst initializes less-namespaced names first.

So I suspect if you called this MyApp::Model::Schema::Precache then
$c->model('Schema')->resultset('Foo') would be fine.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] [Announce] Catalyst-Runtime 5.7099_01 - Developer Release

2008-07-19 Thread Matt S Trout
On Thu, Jun 26, 2008 at 06:50:58PM -0400, Charles Bailey wrote:
> On Wed, Jun 25, 2008 at 4:57 PM, Marcus Ramberg <[EMAIL PROTECTED]> wrote:
> >
> > The feature to note here is 'go', which works like an internal redispatch to
> > another action, while retaining the stash intact. Being able to do this
> > means that in practice you don't ever need to set the template name in
> > stash, but can depend on using go when you want to render the template of
> > the other action, rather than the one you dispatched to.
> 
> Would it make sense to include a function analogous to forward() (say,
> "visit()") in the same way that go() is analogous to detach()?  Seems
> like it'd be a nice way to "wrap" an action that uses auto() or end()
> in its controller to handle tasks common to several actions there.

Maybe. How about doing up a patch for catalyst-dev@ ?

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst::Authentication::Credential::LDAP

2008-07-19 Thread Matt S Trout
On Wed, Jun 25, 2008 at 11:27:13AM -0700, Bruce J Keeler wrote:
> Also, somewhat apropos, I have a 
> C::A::{Store,Credential}::ActiveDirectory  that I based on the LDAP 
> stuff.  The LDAP modules didn't work for me because they want to bind 
> anonymously and retrieve the crypted password, whereas AD just wants to 
> authenticate with a bind.  My stuff also gets role information from AD 
> groups.  I've been meaning to get it out on CPAN one of these days, but 
> it hasn't been a priority; I suppose I can work on it if anyone else 
> needs it though.

Sounds to me like 'auth by bind' versus 'auth by retrieve and check' should
be an option in the LDAP stuff, not a separate module. Fancy doing up
a patch?

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] [Fwd: [rt-users] Security vulnerability in RT 3.0 and up]

2008-07-19 Thread Matt S Trout
On Mon, Jun 23, 2008 at 01:17:15PM -0400, Lance A. Brown wrote:
> H.   Is this something Catalyst needs to worry about?

StackTrace only activates for Catlyst in debug mode.

If you're deploying your app publically in debug mode, you have more than
this to worry about (like exceptions showing your DBI connect info :)

-- 
      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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Capture page on server?

2008-07-19 Thread Matt S Trout
On Tue, Jun 24, 2008 at 12:23:05AM +0800, Martin Ellison wrote:
> I actually want to save a static copy of the front page to improve load
> times. My fastcgi process sometimes disappears (I'm on shared hosting and I
> think they auto-cancel stale processes), and it takes a while for the
> process to be restarted, which impacts the first page load. Subsequent pages
> are faster but it's the first page that makes the impression on the user.
> The static plugin does not work, because that requires fastcgi to be
> running, and my app is too small for me to set up squid.
> 
> So I want to redirect the front page to a static page, but regenerate the
> static page, and also force the app to do something (so the server can
> restart the fastcgi process before the user requests any other page).

Catalyst::Plugin::PageCache ?

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Password policy support for Catalyst::Authentication::Store::LDAP

2008-07-19 Thread Matt S Trout
On Fri, Jun 20, 2008 at 06:46:02PM +0200, Buchan Milne wrote:
> On Friday 20 June 2008 12:20:49 Gavin Henry wrote:
> > 2008/6/20 Buchan Milne <[EMAIL PROTECTED]>:
> > > In our internal management web app (which has only been feasible due to
> > > Catalyst), we authenticate against our OpenLDAP (2.3) infrastructure.
> > >
> > > Due to various security requirements (SAOX etc.), we are required to have
> > > password expiration etc. So, we implemented password policies a while
> > > back using OpenLDAP's slapo-ppolicy overlay
> > > (http://www.openldap.org/software/man.cgi?query=slapo-ppolicy&sektion=5&a
> > >propos=0&manpath=OpenLDAP+2.3-Release)
> > >
> > > Net::LDAP recently added support for the Password Policy control, so at
> > > least this is now feasible (without hacking Net::LDAP, which is where I
> > > got stuck on the previous attempt).
> > >
> > > I think I may be able to provide a patch for Authentication::Store::LDAP,
> > > however, the first problem is that Catalyst::Authentication (like many
> > > other authentication frameworks) assumes the result of an authentication
> > > will always only be a boolean, and thus doesn't make provision for
> > > situations such as:
> > > -The account is locked out (the password may have been correct, but the
> > > user can't authenticate)
> > > -The password was reset and needs to be changed (so, authenticate them
> > > but allow for a means to send them to a password changing facility)
> > > -The password will expire soon
> > > etc.
> > >
> > > I wouldn't like to try and propose a solution for
> > > Catalyst::Authentication (yet), but I can try and provide input on any
> > > proposed solution.
> >
> > Can't you still return a true/false and then provide/use an error
> > method which will then contain the reason for failure, which include
> > the response from ppolicy?
> 
> In theory, yes (from Store::LDAP), but I want to get something back from 
> login(), which just checks the boolean it gets back from the store (I think, 
> don't have anything in front of me now).

New-style auth uses authenticate().

I -think- it should be possible for any true value to be passed back out,
so instead of 'return 1' you could return an object that describes the
current status of the account?

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Bug with $c->request->query_keywords ?

2008-07-19 Thread Matt S Trout
On Thu, Jun 19, 2008 at 12:33:44PM -0600, Larry Leszczynski wrote:
> I've run into what appears to be a query keyword bug using Catalyst
> 5.701[02]:
> 
>% catalyst.pl MyApp
>% cd MyApp
>% perl script/myapp_server.pl
> 
> Request:
> 
>http://localhost:3000/ -> works
>http://localhost:3000/?a=123   -> works
>http://localhost:3000/?123 -> fails
> 
> The error message is:
> 
>[error] Caught exception in engine "Can't locate object
>method "query_keywords" via package "Catalyst::Request"
>at /Library/Perl/5.8.8/Catalyst/Engine.pm line 446."

You've got half a Catalyst::Runtime install of one version and half
another.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] multiple database model support

2008-07-19 Thread Matt S Trout
On Tue, Jul 01, 2008 at 06:20:35AM +0530, jagdish eashwar wrote:
> I am working on two Catalyst applications and have set up different Mysql
> databases for each of them. Some of the tables that these two applications
> use are the same. At present, I am maintaining the common tables in both the
> databases. After reading this thread, I tried putting the common tables in a
> third database and creating two models in each of the Catalyst applications.
> I am, however, unable to set up  relationships between  tables across
> databases. Is this possible?

Yes, kind of.

If they're MySQL, then what I'd do is three sets of DBIC namespaces
and load the ones you need into each app.

DBIC can happily handle ->table('db1.table') under MySQL, and MySQL will
let you join between databases (the same way you'd use schemas in pg)

If you wantto discuss this further, I'd suggest taking it to the dbix-class
list.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: Catalyst site design drafts feedback thread

2008-06-12 Thread Matt S Trout
On Thu, Jun 12, 2008 at 05:00:04PM +0200, Tobias Kremer wrote:
> Point taken! I didn't mean to insult anyone! I'm sorry if that was the
> impression I gave.

Either way it's now corrected :)

> I find it highly problematic and cumbersome to discuss layouts from a 
> graphical
> point of view. One can argue about content, navigation, overall structure and
> other logical things but often the pure design aesthetics just can't be put
> into words. It's an emotional thing, thus my purely emotional response ;-)

I know, but I figure designers are used to interpreting people's best attempts
at putting their feelings into words which makes it worth trying.

> I'll will however try my best to provide some constructive criticism:
> 
> (1) http://www.browsing.co.uk/cat
> 
> If I had to chose one of the proposals it definitely would be this one. With
> some more polishing it could end up quite nice.
> 
> (2) http://agaton.scsys.co.uk/~matthewt/catsite/cat_mock_web_001.png
> 
> I really don't like the "mustard" color scheme which moreover doesn't work
> together with the red catalyst logo. The picture takes up way too much screen
> real estate.
> 
> (3) http://ion0.com/hx/cat/new-version-2-26.jpg
> (4) http://ion0.com/hx/cat/catalystSiteDesign3.jpg
> 
> Too blurry, too much clumsy shadowing and glowing. Too many colors in (4) that
> don't work together well.
> 
> (5) http://agaton.scsys.co.uk/~matthewt/catsite/catsite-Penfold.pdf
> 
> Way too simplistic. Fonts are too big.
> 
> > I am however, much appreciative that you've provided an example of what
> > you think is better - perhaps you could include an explanation of why you
> > think it's better, though? The point here is I'm presenting -first-
> > -drafts- of ideas. +1/-1 can wait until the final designs are done.
> 
> Do you mean the other framework websites or my own proposal?

I was thinking about yours but can I get away with asking for all of the
above? Given myself and kieren both find most of the other sites objectionable
it'd be nice to see why you prefer them.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst site design drafts feedback thread

2008-06-12 Thread Matt S Trout
On Wed, Jun 11, 2008 at 03:58:28PM -0500, Dave Rolsky wrote:
> On Wed, 11 Jun 2008, Dave Rolsky wrote:
> 
> >On Wed, 11 Jun 2008, Matt S Trout wrote:
> >
> >>Simon Elliott:
> >>
> >>(1) http://www.browsing.co.uk/cat
> >
> >Overall my favorite. The white text against the bottom of the grey 
> >gradient starts to fade, but I'm sure that's easily fixed. I wouldn't mind 
> >making all the non-tab text a little larger, but maybe my eyes are a 
> >little older than our target audience ;)
> 
> Also, big bonus points for actually having implemented the darn thing!
> 
> All the other are mockups. We don't know how well they'll translate into 
> HTML & CSS. This one uses nice semantic HTML and CSS. Double bonus points 
> for using YUI Grids, which should help keep future maintenance easier.

I'm expecting the final drafts to be HTML.

I'm also expecting the designers already know they'll translate fine. That's
their area of expertise and I'm happy to leave it to them, since what the
final voting will be on will be HTML anyway.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: Catalyst site design drafts feedback thread

2008-06-12 Thread Matt S Trout
On Thu, Jun 12, 2008 at 09:48:55AM +0200, Tobias Kremer wrote:
> I don't want to sound rude but I don't like any of the proposed
> designs. To be honest, from a stilistic point of view they all look
> worse than the current Catalyst frontpage. They all pale in comparison
> to nearly EVERY other MVC framework's web site. Look at djangoproject.com,
> cakephp.org, symfony-project.org, even rubyonrails.org with its
> simplistic approach is much more attractive. No offense, but if this
> is a glimpse at the future of catalyst.perl.org I'm seriously worried
> about the framework's future. This is how to NOT attract new users.

the django one makes my eyes cross, the cake one makes my eyes bleed, the
symfony one is ok but clashes and I like the rails one mostly although it
feels like a targeted advertising site rather than a project web site (not
necessarily a bad thing but always makes me twitch a little).
 
> Once again, sorry for being so negative but this just shows how much I
> care about Catalyst gaining more attention.

Enough to say you hate them all but not enough to try and say why.

So it's subjective - the whole point of this was to provide -feedback- so
the designers could understand what people did and didn't like. Telling us
you'd be worried about Catalyst's future if we used any without a single
bit of constructive criticism is ... well, frankly, completely useless for
anything except insulting the designers who were kind enough to create
mockups for us.

I am however, much appreciative that you've provided an example of what
you think is better - perhaps you could include an explanation of why you
think it's better, though? The point here is I'm presenting -first-
-drafts- of ideas. +1/-1 can wait until the final designs are done.

-- 
  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.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


<    1   2   3   4   5   >