Re: [Catalyst] Doc patch for ConfigLoader.

2009-05-14 Thread Tomas Doran

Louis Erickson wrote:
I wrote a blog entry the other day about ConfigLoader and what the file 
names generated by MYAPP_CONFIG_LOCAL_SUFFIX etc. are.  t0m suggested I 
write a patch.  I've done so.


Nice one!


Having done that, I am confident I used the most current code.  =)


Applied perfectly, passes tests, looks good to me - applied as r10153 
with Changelog entry.


I also began to see why it's hard to catch these, as I noticed that this 
behavior is documented in the existing docs if you understand how it works 
already.


Yes, exactly!! That's why we try so hard to get people to write it down 
when they have that lightbulb moment. It's impossible to document it 
right when you just wrote the feature...


With these docs in place, I would have found what I was looking for and 
not spent time debugging.


Please let me know if you have any suggestions, changes, or if the patch 
does not work for some reason.


That was perfect.

Nice work, many many thanks.
t0m


___
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] Caught exception in engine Can't call method header on an undefined value

2009-05-14 Thread Tomas Doran

Malloy wrote:

What's wrong with my application?


No idea, not enough info.

What version of Catalyst are you using, and can you load 
Devel::SimpleTrace to turn this into a stack trace which will tell us 
what methods your actually in when you get the exception.


Cheers
t0m

___
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] Testing controller which require login.

2009-05-14 Thread Peter Karman
Louis Erickson wrote on 05/13/2009 12:07 AM:

 Can I just generate the cookie and put it in the cookie store directly 
 before the query is made to the application?  I can generate the cookie 
 with the SSO library.  I don't see a way to do that through either test 
 tool.
 

I'm coming in late on this thread, but can at least offer a how I do
it case.

Catalyst::Authentication::AuthTkt is a shim for Apache::AuthTkt, a
cookie-based SSO system. In order to test how the Session and
Authentication plugins interact, I hacked around how Catalyst::Test does
requests in order to preserve a session cookie over multiple requests.

You can see the AuthTkt tests here[0]. The my_request() function just
sets $ENV{COOKIE} and lets the standard AsCGI magic work. I'm sure
that's a Bad Way to Do It, but it works.

I would love to see some basic cookie features in Catalyst::Test, and if
I knew the Right Way to do it, I'd be happy to add code. I use
Catalyst::Test for most things. It is simple, comes with Catalyst so
there's no extra dep. I have used the Mech tests too, and Mech is cool.
But I like keeping my deps down where I can.

[0]
http://cpansearch.perl.org/src/KARMAN/Catalyst-Authentication-AuthTkt-0.10/t/01-authtkt.t

-- 
Peter Karman  .  pe...@peknet.com  .  http://peknet.com/


___
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] Problem with objects

2009-05-14 Thread Matt S Trout
On Wed, May 13, 2009 at 03:09:54PM -0300, Naylor Garcia wrote:
 Hi all,
 
 I am creating a sub in the Model/IMAP.pm makes no connection with the
 database, but performs authentication via IMAP. But failing to call this sub
 in the controller.
 
 I am new to Catalyst and appreciate the help.

You asked this on IRC. We asked for:

The Model/IMAP.pm

The Controller calling it

The full output of myapp_server.pl -d as you make a request to it that
causes the exception.

Until you give us those, we can't easily help you - what you've said so far
is like your mum calling you and saying help the internet is broken - way
too vague to provide a useful answer :)

-- 
Matt S Trout Catalyst and DBIx::Class consultancy with a clue
 Technical Director  and a commit bit: http://shadowcat.co.uk/catalyst/
 Shadowcat Systems Limited
  mst (@) shadowcat.co.ukhttp://shadowcat.co.uk/blog/matt-s-trout/

___
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] Handling of keywords for controller methods

2009-05-14 Thread Matt S Trout
On Wed, May 13, 2009 at 08:28:22PM +0200, Roland Lammel wrote:
 For the records, just did my first commit for Catalyst to resolve this.
 
 Thnx for directions.

Welcome to the team. I think you forgot to add yourself to

http://search.cpan.org/~flora/Catalyst-Runtime-5.80003/lib/Catalyst.pm#CONTRIBUTORS

though ... (alphabetical by IRC nick please)

-- 
Matt S Trout Catalyst and DBIx::Class consultancy with a clue
 Technical Director  and a commit bit: http://shadowcat.co.uk/catalyst/
 Shadowcat Systems Limited
  mst (@) shadowcat.co.ukhttp://shadowcat.co.uk/blog/matt-s-trout/

___
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] Testing controller which require login.

2009-05-14 Thread Louis Erickson
 
I'm using AuthTkt, and it works very well.

Why didn't it occur to me to look at the tests for it?

On Thu, 14 May 2009, Peter Karman wrote:

 You can see the AuthTkt tests here[0]. The my_request() function just
 sets $ENV{COOKIE} and lets the standard AsCGI magic work. I'm sure
 that's a Bad Way to Do It, but it works.

Why is it a bad way?  If it's a standard and documented part of AsCGI, 
then it should continue to work properly, shouldn't it?

Looking at Catalyst::Test, it seems to call the same function, at least 
for local requests.  The same environment variable should work.  It isn't 
implemented for remote requests, so I guess it isn't a general case.

 I would love to see some basic cookie features in Catalyst::Test, and if
 I knew the Right Way to do it, I'd be happy to add code. I use
 Catalyst::Test for most things. It is simple, comes with Catalyst so
 there's no extra dep. I have used the Mech tests too, and Mech is cool.
 But I like keeping my deps down where I can.

It looks to me like it would be pretty straightforward... there's a 
function called _customize_request which takes the contents of a hash and 
adjusts the request before it is used.  Currently that only lets the host 
be set.  To add the setting of cookie values to that hash looks 
straightforward.  It would then work with both local and remote queries, 
too.  I wonder if it could be generalized to let you set any header at 
all?

The question I asked in the other message about cookies and Catalyst::Test 
is: Is that a good idea?  Should it get added and/or documented, and let 
people use it, or should people be pointed at Mechanize or other tools?

-- 
Louis Erickson - lerick...@rdwarf.net - http://www.rdwarf.com/~wwonko/

If you push the extra ice button on the soft drink vending machine,
you won't get any ice.  If you push the no ice button, you'll get
ice, but no cup.

___
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] Doc patch for ConfigLoader.

2009-05-14 Thread Matt S Trout
On Wed, May 13, 2009 at 10:02:36PM -0700, Louis Erickson wrote:
 I also began to see why it's hard to catch these, as I noticed that this 
 behavior is documented in the existing docs if you understand how it works 
 already.

I have a bit of a rant that relates to this -

http://www.shadowcat.co.uk/archive/conference-video/yapc-eu-2008/you-arent-good-enough/
 
 With these docs in place, I would have found what I was looking for and 
 not spent time debugging.

Awesomeness. Thank you -very- much.

-- 
Matt S Trout Catalyst and DBIx::Class consultancy with a clue
 Technical Director  and a commit bit: http://shadowcat.co.uk/catalyst/
 Shadowcat Systems Limited
  mst (@) shadowcat.co.ukhttp://shadowcat.co.uk/blog/matt-s-trout/

___
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] Caught exception in engine Can't call method header on an undefined value

2009-05-14 Thread Matt S Trout
On Thu, May 14, 2009 at 11:47:16AM +0800, Malloy wrote:
 What's wrong with my application?
 
 [error] Caught exception in engine Can't call method header on an
 undefined value at /usr/local/share/perl/5.10.0/Catalyst.pm line 1838.
 When get this error, I can't open the web page.

Update Catalyst::Runtime to the latest version - you've got one of the early
5.80s with a weird context constructor bug, I think.

-- 
Matt S Trout Catalyst and DBIx::Class consultancy with a clue
 Technical Director  and a commit bit: http://shadowcat.co.uk/catalyst/
 Shadowcat Systems Limited
  mst (@) shadowcat.co.ukhttp://shadowcat.co.uk/blog/matt-s-trout/

___
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] Testing controller which require login.

2009-05-14 Thread Peter Karman
Louis Erickson wrote on 05/14/2009 09:39 AM:
  
 I'm using AuthTkt, and it works very well.

glad to hear it.

If you're using AuthTkt, then the whole cookie this is a non-issue. Just
pass the ticket as a URL param like the tests do. The plugin supports
both ways (cookie and param).

 
 Why didn't it occur to me to look at the tests for it?

I have had to learn that habit myself.

 
 On Thu, 14 May 2009, Peter Karman wrote:
 
 You can see the AuthTkt tests here[0]. The my_request() function just
 sets $ENV{COOKIE} and lets the standard AsCGI magic work. I'm sure
 that's a Bad Way to Do It, but it works.
 
 Why is it a bad way?  If it's a standard and documented part of AsCGI, 
 then it should continue to work properly, shouldn't it?
 

It should probably be:

 local $ENV{COOKIE} = $cookie;

instead. It's a little nitpicky, since in this particular case setting
the global env var doesn't hurt, but in general I try to avoid setting
class/global/env vars unless I really want global behaviour.

 The question I asked in the other message about cookies and Catalyst::Test 
 is: Is that a good idea?  Should it get added and/or documented, and let 
 people use it, or should people be pointed at Mechanize or other tools?
 

Seems like a good idea to me to make some sort of official way to
get/set cookies in Catalyst::Test. I won't have time soon to try it
myself; care to try a patch yourself?


-- 
Peter Karman  .  pe...@peknet.com  .  http://peknet.com/


___
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] Installing Catalyst::Authentication::Store::DBIx::Class Breaks Catalyst

2009-05-14 Thread Collin Condray
It looks like the problem is resolved. I upgraded to the latest version of
Catalyst and Authentication/Authorization started working normally. Funny
how that happens.

Thanks for the follow up. I appreciate it!

Collin Condray
condray.net


On Tue, May 12, 2009 at 7:28 AM, kakim...@tpg.com.au wrote:

 Hello, Collin

  I have the same configuration and output of the Catalyst config too!

 My problem is a bit different. I could login but the accounts that have
 'admin' roles would never get detected of the 'admin' role.

  How are you doing with this issue?


 Guys, please comment.

  Thank you:)

 K. akimoto


 Quoting Collin Condray ccond...@gmail.com:

  Tomas,
 
  Here's the config section of the debug output:
 
  do {
my $a = {
  Action::RenderView = {
ignore_classes = [
DBIx::Class::ResultSource::Table,
DBIx::Class::ResultSourceHandle,
DateTime,
  ],
scrubber_func  = sub { ??? },
  },
  Plugin::Authentication = {
default_realm = dbic,
realms = {
  dbic = {
credential = {
  class = Password,
  password_field = password,
  password_hash_type = SHA-1,
  password_type = hashed,
},
store = {
  class = DBIx::Class,
  ignore_fields_in_find = [],
  role_field = role,
  role_relation = roles,
  store_user_class =
  Catalyst::Authentication::Store::DBIx::Class::User,
  user_class = myappDB::Users,
},
use_session = 1,
  },
},
use_session = 1,
  },
  Plugin::ConfigLoader = {},
  authentication = 'fix',
  custom-error-messsage = { error-template =
  internal_error.tt,
  view-name = TToolkit },
  email = [Sendmail],
  home = /home/.avis/username/domainname.com/myapp,
  name = myapp,
  require_ssl = { no_cache = 0, remain_in_ssl = 1 },
  root = bless({
dirs = [
  ,
  home,
  .avis,
  username,
  domainname.com,
  myapp,
  root,
],
file_spec_class = undef,

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