Re: [Catalyst] Non-real world irrelevant benchmarks

2006-11-17 Thread Michael Reece
fwiw, earlier this week i ran some simple 'ab -n 100 -c 10'  
benchmarks comparing an existing complex Mason site with the same  
site sitting behind a simple Catalyst front end.


the results showed nearly identical performance, with Mason-only  
winning slightly for 100 requests, and Catalyst-powered winning  
slightly for 200 requests.


and by slightly, i do mean slightly -- 3.37 req/s vs 3.40 req/s in  
one test, 3.30 req/s vs 3.26 req/s in the other test.  (slowish,  
sure, but that's just a sandbox server and the /index.html page  
tested is very heavily database driven.)


at this point, the Catalyst front end simply replicates the  
functionality previously done via custom mod_perl handlers (setting  
up cobrands, databases, etc), letting the default controller pass  
through to the (custom) Mason view.


these benchmarks were enough to easy management worries about the  
recent Rails/Django/Catalyst benchmarks, and we are proceeding with  
refactoring our application into Catalyst with the expectation that  
we will eventually see better performance by having many functions  
currently handled by Mason be handled by Catalyst controllers instead  
(such as dynamic image creation, form processing and redirect-after- 
POST, authentication/authorization management).


michael.

On Nov 16, 2006, at 6:01 PM, Perrin Harkins wrote:


Nilson Santos Figueiredo Junior wrote:

Anyone knows how Mason compares to TT, performance-wise?


There are some very old benchmarks here:
http://chamas.com/bench/#2000

These are not ideal though, because they compare the cost of using  
Mason as your controller and templating system to the cost of a  
simple mod_perl handler plus TT.  What you really want is a  
benchmark comparing them through Catalyst.


Regarding your TT performance issues, there are some common things  
to do, which you can find in the TT list archives.  I'd still like  
to see your dprof output sorted by real time, since it seems  
impossible that a TT template could take 4 seconds unless it's  
doing something like fetching from a database or the TT cache is  
turned off.


- Perrin




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] pre-loading with PerlModule

2006-11-22 Thread Michael Reece

If i leave out (from my httpd.conf)

PerlModule MyApp

then everything is loaded at the first request.  i would prefer to  
preload so the first request is faster, but if i add the PerlModule  
directive to the apache (Apache/1.3.36 (Unix) mod_perl/1.29) config,  
then i get


[warn] Setting config after setup has been run is not a good idea.
[warn] Running setup twice is not a good idea.

plus a host of redefine warnings from the prepare/dispatch/finalize/ 
etc overrides defined in MyApp.pm, plus, if i have those methods use  
NEXT instead of SUPER, a few of these


	Deep recursion on subroutine NEXT::AUTOLOAD at /usr/local/lib/ 
perl5/site_perl/5.8.8/Catalyst/Plugin/StackTrace.pm line 75.


plus a broken app (all requests hang, with another Deep recursion on  
NEXT::AUTOLOAD error).


anyone else have trouble with the PerlModule directive or hints or  
suggestions?


thanks,
michael.


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] pre-loading with PerlModule

2006-11-22 Thread Michael Reece

thanks, perrin!

that works!  do you know why this makes a difference?


On Nov 22, 2006, at 10:04 AM, Perrin Harkins wrote:


Michael Reece wrote:

PerlModule MyApp


Try this instead:

Perl
  use MyApp;
/Perl

Or do that in a separate startup.pl script called from httpd.conf  
with PerlScript.


- Perrin



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] question from tutorial - does creating HTML in a controller using HTML::Widget violate MVC?

2006-12-06 Thread Michael Reece


On Dec 5, 2006, at 6:06 PM, John Siracusa wrote:

My stance has always been that I don't mind code in templates so  
long as
the sole purpose of that code is to layout and format the data.   
IOW, a view
should never retrieve, create, or modify data.  It should just move  
around

and format what it's been given.


what about implicit data retrieval via method calls on objects passed  
to templates?


% $thing-owner-name %




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst::Controller::FormBuilder config problem

2007-01-02 Thread Michael Reece


On Jan 2, 2007, at 7:28 AM, Matt S Trout wrote:



On 21 Dec 2006, at 18:05, Michael Reece wrote:

be wary of putting your base controller class in the MyApp/ 
Controller/ directory, because catalyst will load it as a  
controller itself.  which sucks if you want to put default  
inheritable actions in your base class.  i use MyApp/Controller.pm  
for the base class to avoid this problem, since catalyst still, as  
far as i can tell, has no way to let you specify which controller  
classes to load or not load.


Then you didn't read the docs on setup_components in Catalyst.pm



aha, it looks like Module::Pluggable was made more useful last april  
or so.  thanks for the pointer.



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] 404 Not Found

2007-01-02 Thread Michael Reece
will things break if i delete the Makefile.PL and define a home in  
the config?


if so, then my problem is solved!

On Jan 2, 2007, at 9:26 AM, Chisel Wright wrote:


On Tue, Jan 02, 2007 at 09:18:54AM -0800, Michael Reece wrote:

we do our best to let you organise stuff how -you- want to rather
than how we think you're going to want to.


with that in mind, can something be done about the Makefile.PL
location requirement? ;)


Since you haven't said what [you think] is wrong with it, probably  
not.


Also the post you replied to said let you organise stuff ... if it's
somewhere you don't want it - move it.

Chisel
--
Chisel Wright
e: [EMAIL PROTECTED]
w: http://www.herlpacker.co.uk/

  The ballerina broke the toilet.

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/ 
catalyst@lists.rawmode.org/

Dev site: http://dev.catalyst.perl.org/


---
michael reece :: software engineer :: [EMAIL PROTECTED]



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Catalyst::Controller::BindLex RECIPE for :Param

2007-01-02 Thread Michael Reece

i am trying to follow the recipe mentioned here:

http://search.cpan.org/~nuffin/Catalyst-Controller-BindLex-0.03/lib/ 
Catalyst/Controller/BindLex.pm#RECIPES


__PACKAGE__-config-{bindlex}{Param} = sub { $_[0]-req- 
params };


after the obvious s/=/=/, i put this line in MyApp/Controller.pm  
(the base class for all my controllers).


  package MyApp::Controller;
  use base qw/Catalyst::Controller::BindLex/;

  __PACKAGE__-config-{bindlex}{Param} = sub { $_[0]-req-params };

however, i wonder if the base controller is not the right place for  
this, or if anyone has successfully managed to implement this recipe.


after restarting my app, what used to be

[debug] Loaded Path actions:
.- 
+--.
| Path|  
Private  |
+- 
+--+
| /   | / 
index   |
| /admin/index| /admin/ 
index |
| /area_overview  | /area_overview/ 
index |
| /captcha| /captcha/ 
index   |
| /captcha/image  | /captcha/ 
image   |
| /catalyst   | / 
catalyst|
| /error/bad_conf_name| /error/ 
bad_conf_name |
| /error/dump | /error/ 
dump  |
| /error/no_conf_name | /error/ 
no_conf_name  |
| /headerimage| /headerimage/ 
default |
| /headerimage| /headerimage/ 
index   |

[..snip..]

becomes

[debug] Loaded Path actions:
.- 
+--.
| Path|  
Private  |
+- 
+--+
| /   | / 
index   |
| /   | / 
index   |
| /   | / 
index   |
| /   | / 
default |
| /   | / 
index   |
| /bad_conf_name  | / 
bad_conf_name   |
| /catalyst   | / 
catalyst|
| /dump   | / 
dump|
| /image  | / 
image   |
| /index  | / 
index   |

[..snip..]

which is decidedly not right.

other controllers below this list are mapped the same before and  
after, but these are not.


any ideas?  thx.


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst::Controller::BindLex RECIPE for :Param

2007-01-02 Thread Michael Reece

narrowed this down to a failure even with:

  package MyApp::Controller;
  use base qw/Catalyst::Controller/;
  __PACKAGE__-config;

so it does not appear to be related to BindLex, but something about  
calling __PACKAGE__-config within the controller base class.  i'll  
keep digging.



On Jan 2, 2007, at 10:47 AM, Michael Reece wrote:


i am trying to follow the recipe mentioned here:

http://search.cpan.org/~nuffin/Catalyst-Controller-BindLex-0.03/lib/ 
Catalyst/Controller/BindLex.pm#RECIPES


__PACKAGE__-config-{bindlex}{Param} = sub { $_[0]-req- 
params };


after the obvious s/=/=/, i put this line in MyApp/Controller.pm  
(the base class for all my controllers).


  package MyApp::Controller;
  use base qw/Catalyst::Controller::BindLex/;

  __PACKAGE__-config-{bindlex}{Param} = sub { $_[0]-req-params };

however, i wonder if the base controller is not the right place for  
this, or if anyone has successfully managed to implement this recipe.


after restarting my app, what used to be

[debug] Loaded Path actions:
.- 
+--.
| Path|  
Private  |
+- 
+--+
| /   | / 
index   |
| /admin/index| /admin/ 
index |
| /area_overview  | /area_overview/ 
index |
| /captcha| /captcha/ 
index   |
| /captcha/image  | /captcha/ 
image   |
| /catalyst   | / 
catalyst|
| /error/bad_conf_name| /error/ 
bad_conf_name |
| /error/dump | /error/ 
dump  |
| /error/no_conf_name | /error/ 
no_conf_name  |
| /headerimage| /headerimage/ 
default |
| /headerimage| /headerimage/ 
index   |

[..snip..]

becomes

[debug] Loaded Path actions:
.- 
+--.
| Path|  
Private  |
+- 
+--+
| /   | / 
index   |
| /   | / 
index   |
| /   | / 
index   |
| /   | / 
default |
| /   | / 
index   |
| /bad_conf_name  | / 
bad_conf_name   |
| /catalyst   | / 
catalyst|
| /dump   | / 
dump|
| /image  | / 
image   |
| /index  | / 
index   |

[..snip..]

which is decidedly not right.

other controllers below this list are mapped the same before and  
after, but these are not.


any ideas?  thx.


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/ 
catalyst@lists.rawmode.org/

Dev site: http://dev.catalyst.perl.org/


---
michael reece :: software engineer :: [EMAIL PROTECTED]



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] RFC $c-uri_to

2007-01-03 Thread Michael Reece
$c-uri_for() is great and all, but i usually am more interested in  
getting a uri for an action rather than a uri to a template (or  
public path).


(incidentally, i feel uri_for would be better named uri_to, and the  
sub below named uri_for, but i digress.)


the following code is what i have come up with.  i present it here  
for feedback, comments, etc.


## my $uri = $c-uri_to( $controller_path, @path_args );
## my $uri = $c-uri_to( $controller_path, @path_args, \%query_args );
## my $uri = $c-uri_to( $controller_path, @path_args,  
[EMAIL PROTECTED] );# for :Regex() actions
#   $controller_path is '/controller/method' (preferred) or  
'method' (in current $c-controller)

sub uri_to {
my $c = shift;
my $namespace = shift;
my @args  = @_;

my @path_args;
my $snippets;
my $query;
foreach (@args) {
if (ref eq 'ARRAY') {
$snippets = $_;
} elsif (ref eq 'HASH') {
$query = $_;
} else {
push @path_args, $_;
}
}

my $path = $namespace;
unless ($path =~ m{^/}) {
my $ns = $c-namespace;# get current namespace
if ($ns eq '') {
$path = /$path;  # Root controller has namespace=''
} else {
$path = /$ns/$path;
}
}

my $action = $c-dispatcher-get_action_by_path($path);
unless ($action) {
$c-log-error(uri_to cannot get_action_by_path($path));
return undef;
}

my @action_args = (defined $snippets) ? @$snippets : ();
my $uri = $c-dispatcher-uri_for_action($action, @action_args);
unless ($uri) {
$c-log-error(uri_to cannot find uri_for_action $action);
return undef;
}

my @uri_args = (defined $query) ? ($query) : ();
$uri = $c-uri_for($uri, @path_args, @uri_args);#  
stringify important here

return $uri;
}

there is a good chance i am re-inventing a wheel here!


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] RFC $c-uri_to

2007-01-03 Thread Michael Reece


On Jan 3, 2007, at 12:04 PM, Ash Berlin wrote:


Michael Reece wrote:
$c-uri_for() is great and all, but i usually am more interested  
in getting a uri for an action rather than a uri to a template (or  
public path).
(incidentally, i feel uri_for would be better named uri_to, and  
the sub below named uri_for, but i digress.)
the following code is what i have come up with.  i present it here  
for feedback, comments, etc.

## my $uri = $c-uri_to( $controller_path, @path_args );
## my $uri = $c-uri_to( $controller_path, @path_args, \% 
query_args );
## my $uri = $c-uri_to( $controller_path, @path_args,  
[EMAIL PROTECTED] );# for :Regex() actions
#   $controller_path is '/controller/method' (preferred) or  
'method' (in current $c-controller)

sub uri_to {
[..snip..]
my $action = $c-dispatcher-get_action_by_path($path);
[..snip..]
my $uri = $c-dispatcher-uri_for_action($action, @action_args);
[..snip..]
$uri = $c-uri_for($uri, @path_args, @uri_args);#  
stringify important here

return $uri;
}
there is a good chance i am re-inventing a wheel here!


Take a look at uri_for_aciton in http://dev.catalystframework.org/ 
browser/branches/Catalyst-Runtime-ctx-uri_for_action (see t/ 
unit_core_uri_for_action.t) and tell me if that does what you  
wanted or not.


Ash



i can't tell from reading the .t source, does that support $c- 
uri_to_action('local_method') as well as $c-uri_to_action('/ 
controller/method'), similar to the way $c-forward() works?


reading the source at http://dev.catalystframework.org/browser/ 
branches/Catalyst-Runtime-ctx-uri_for_action/lib/Catalyst.pm, it  
looks like it would except that line 960 is commented out.  or maybe  
that's part of what $dispatcher-contextual_uri_for_action is doing.




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] CALLING FOR VCS AND EDITOR REGEXES

2007-01-26 Thread Michael Reece

here's one

[.]_.*[.]pm


On Jan 26, 2007, at 2:27 PM, Matt S Trout wrote:

Bored now. I've suggested to a dozen people we should put together  
a list of common VCS and editor file matches to submit back to  
Module::Pluggable as default skips. So far, I've had lots of  
complaints and two people trying to patch Catalyst.pm. Not happy.


So, everybody with dumbass editors and version control systems that  
like polluting lib, get chore patterns for these files in this  
thread. If nobody else collects 'em up and sends 'em to muttley, I  
will, because I'm sick of hearing about this :)


--
Matt S Trout, Technical Director, Shadowcat Systems Ltd.




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] O?Reilly might yet be interested after all

2007-02-06 Thread Michael Reece


On Feb 6, 2007, at 6:55 AM, Matt S Trout wrote:



On 6 Feb 2007, at 14:30, Fernan Aguero wrote:


The other could be more annoying for a beginner: you have to
learn a new set of syntax rules to use TT. Even if there's
already another book about TT, you might want to at least skim
through some simple TT templates.

And the typical beginner question would then follow:
OK, I see why you need a delimiter/marker ('[% %]') to tell TT which
parts of the template should be processed, but what I just
don't see is why I can't use standard Perl syntax within
these delimiters!


That way lies PHP.


or HTML::Mason :)


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] populating stash via action attributes

2007-02-14 Thread Michael Reece



i am trying to do something along the lines of:

sub foo : Local HelloWorld {
  my ($self, $c) = @_;

  $c-res-body( $c-stash-{hello} );	# was already set to 'world'  
because of attribute HelloWorld

}


is this possible?  any tutorials around that deal with such things?



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] populating stash via action attributes

2007-02-14 Thread Michael Reece

thanks to phaylon, i got this figured out.

[ in a controller base class ]
sub _parse_Hello_attr { ActionClass = 'MyApp::Action::Hello' }



[ and elsewhere... ]
package MyApp::Action::Hello;
use base 'Catalyst::Action';

sub execute {
  my $self = shift;
  my ($controller, $c) = @_;
  $c-stash-{hello} = 'world';
  return $self-NEXT::execute(@_);
}


On Feb 14, 2007, at 4:40 PM, Michael Reece wrote:




i am trying to do something along the lines of:

sub foo : Local HelloWorld {
  my ($self, $c) = @_;

  $c-res-body( $c-stash-{hello} );	# was already set to 'world'  
because of attribute HelloWorld

}


is this possible?  any tutorials around that deal with such things?



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/ 
catalyst@lists.rawmode.org/

Dev site: http://dev.catalyst.perl.org/


---
michael reece :: software engineer :: [EMAIL PROTECTED]



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Regex -- optional index.html

2007-03-02 Thread Michael Reece

i don't think it's a bug.


Catalyst::Manual::Intro also says:

  You can pass variable arguments as part of the URL path, separated  
with forward slashes (/). If the action is a Regex or LocalRegex, the  
'$' anchor must be used. For example, suppose you want to handle /foo/ 
$bar/$baz, where $bar and $baz may vary:


sub foo : Regex('^foo$') { my ($self, $context, $bar, $baz) = @_; }
[..snip..]

  If a Regex or LocalRegex action doesn't use the '$' anchor, the  
action will still match a URL containing arguments, however the  
arguments won't be available via @_.



have you tried adding :Args(0) to the action?


On Mar 2, 2007, at 9:59 AM, Bill Moseley wrote:


On Thu, Mar 01, 2007 at 04:13:05PM -0800, Bill Moseley wrote:

Seems that Catalyst first tries to match the full path, then tries to
match a reduced path.  Adding a bit of debugging to Regex.pm's  
match()

method:

Request = /training/webcasts/webcast_data/162/foo.html

Checking [training/webcasts/webcast_data/162/foo.html]
Checking [training/webcasts/webcast_data/162]
*MATCHED*


Ok, so is that a bug?  Or am I not understanding the docs?

# Regex

sub bar : Regex('^item(\d+)/order(\d+)$') { }

Matches any URL that matches the pattern in the action key, e.g.
http://localhost:3000/item23/order42. The '' around the regexp is
optional, but perltidy likes it. :)

So it seems that would also match:

http://localhost:3000/item23/order42/something.else

but the $ would indicate to me that it much only match the shorter
string.


--
Bill Moseley
[EMAIL PROTECTED]


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/ 
catalyst@lists.rawmode.org/

Dev site: http://dev.catalyst.perl.org/


---
michael reece :: software engineer :: [EMAIL PROTECTED]



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst::Log::Log4perl branch

2007-03-02 Thread Michael Reece
this brings up an interesting difference in side-effects of  
Catalyst::Log-error() and Log::Log4perl-error().


in the course of trying to integrate catalyst logging with other  
existing Log4Perl loggers in the codebase, i had tried first setting  
catalyst's logger to be the global logger,


  $c-log($one_true_logger);

but ran into issues like those you are trying to solve.

so i tried an alternate approach,

  $one_true_logger = $c-log;

but i have existing code that relies on the side-effect of  
$log4perl_logger-error() [and friends] returning undef,


  return $one_true_logger-error('oops');# logs and returns false

but Catalyst::Log::_log ends with (and thus returns)

$self-{body} .= sprintf( [%s] %s, $level, $message );

is there any reason not to patch Catalyst::Log::_log to 'return;'  
after appending $self-{body}?


(or perhaps better in the method generation,

*{$name} = sub {
my $self = shift;

if ( $self-{level}  $level ) {
$self-_log( $name, @_ );
}
+   return;
};

so the false RV is reliable even if level is too low.



On Mar 2, 2007, at 11:26 AM, Adam Jacob wrote:

Several people have pointed out that various parts of Log::Log4perl  
don't work well with Catalyst.  Specifically, many of the options  
that rely on Stack information are incorrect.  The format strings:


%L Line number within the file where the log statement was issued
%F File where the logging event occurred
%C Fully qualified package (or class) name of the caller
%M Method or function where the logging request was issued
%l Fully qualified name of the calling method followed by the  
callers source the file name and line number between parentheses.


Sebastian Willert has helpfully provided a patch that should  
resolve these issues.  He rules.  His changes have been put on this  
branch:


http://dev.catalyst.perl.org/repos/Catalyst/branches/Catalyst-Log- 
Log4perl/cspec-fixes


I'm going to be pretty busy for the next few days, but don't want  
to sit on this any longer.  Can those of you using  
Catalyst::Log::Log4perl give this a whirl, and make sure it works  
with your applications? (And doesn't cause any kind of nasty  
performance implications, especially with the cspec fixes disabled?)


Your rewards will be my enduring gratitude, and a better  
Catalyst::Log::Log4perl.


Thanks!

Adam

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/ 
catalyst@lists.rawmode.org/

Dev site: http://dev.catalyst.perl.org/




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Template Engine

2007-03-13 Thread Michael Reece
you will find that most here use Template Toolkit, but i prefer  
HTML::Mason, because i can do really interesting things with an OO- 
based templating system.  but embedding perl into HTML may not be  
what you mean by promotes good practices .. mason is pretty  
agnostic in that regard, but you can develop and enforce your own  
good practices.


On Mar 13, 2007, at 12:00 PM, Mesdaq, Ali wrote:


I just wanted to get everyone's feedback on what they prefer as their
templating engine. I know there are a bunch of choices but wanted  
to see

what people think of certain ones. I am looking for something that
supports and promotes good practices and cutting edge techniques.

--
Ali Mesdaq




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Root.pm $c-detach() does not detach?

2007-04-03 Thread Michael Reece


On Apr 3, 2007, at 9:18 AM, Luis Azevedo wrote:


Hi All,

In Root.pm, auto action I am trying to break the execution of  
chain of

Actions.

To be more exact, whenever I detect I loose connection to a socket  
or cookie
session, I want to redirect the user to a login action, not  
rendering the

action the user is calling.

I know I can make a simple $c-res-redirect() but the problem is I  
need to
show a message in the login page telling the reason for the  
logout. Usually
I am passing messages trough Stash. Redirecting to the Login page  
needs to
pass message somehow (through GET or POST, therefore not so  
beautiful s).




see $c-flash method in perldoc Catalyst::Plugin::Session --
Think of it as a stash that lasts for longer than one request,  
letting you redirect instead of forward.



I have tried to detach the /login action,  in auto action from  
Root.pm
controller,  but it is not working and I don't know why. See the  
actions

chain:
| /auto
|  - /login/index
| /about/index
| /end

The user called the /about action.

Can I break the chain somehow in Root.pm, auto action?


have you tried avoiding detach and using { $c-forward('/login/ 
index'); return 0; } ?




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] A View that may include elements optionally returnedfrom other funcs

2007-04-25 Thread Michael Reece
my approach in cases like this has been to have models/database  
tables for the pages themselves.


- a page has_many components
- a controller queries the db for the components to display on the  
page[*] and stashes the list
- the controller, now knowing which components will be displayed,  
stashes the appropriate data

- the template loops the list of components and includes each one
- the editor uses an admin interface to select which components to  
display on each page


[*] i've done this via attributes, so any action method  
marked :CustomizablePage gets preprocessed by a Catalyst::Action  
subclass that populates $c-stash-{show_comps}



On Apr 25, 2007, at 8:07 AM, Carl Johnstone wrote:

Maybe I am confused about MVC, but wouldn't you want the view to  
decide how to
present what is sent to it by the controller, and hence have the  
controller

handle this?


I don't know if it's you that's confused or me that's confused ;-)  
I can see your point of view though.


From my point of view, the View is handled by a designer. The  
designer
knows about HTML, CSS, JS, and enough about TT to get them going.  
They typically wouldn't know anything about perl.


When the designer assembles the pages he decides which of the  
possible common elements is going on each page and will include the  
relevant sub-templates. It makes sense for me to be able to  
delegate control of that to the designer by just letting them  
include what they like without having to be involved every time  
something changes.


As an example during the summer the designer might take the  
football league tables off the site in favour of something else. In  
my Controller though the code that generates that data will still  
be run even though it's now redundant.


Carl



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/ 
catalyst@lists.rawmode.org/

Dev site: http://dev.catalyst.perl.org/


---
michael reece :: software engineer :: [EMAIL PROTECTED]



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] perl -d myapp_server.pl : how ?

2007-04-27 Thread Michael Reece
i usually stick $DB::single=1 at the top of the controller method i  
am debugging, then perl -d ./script/myapp_server.pl

it then drops to the debugger prompt after i make the http request.

On Apr 27, 2007, at 5:04 AM, Dami Laurent ((PJ)) wrote:


Hello,

The question was already asked in the list, but I can't remember of  
any satisfying answer.


Did anybody succeed in running the standalone server in debug mode ?

Seems that the server main loop, waiting for HTTP events, is not  
compatible with the debugger loop waiting for keyboard events.


I'm able to set breakpoints after Catalyst has loaded all modules  
and just before entering MyApp-run($port, $host ...) .. but the  
breakpoints never actually break.


Thanks in advance, L. Dami

PS I'm running perl v5.8.8 built for MSWin32-x86-multi-thread,  
Binary build 819 [267479] provided by ActiveState



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/ 
catalyst@lists.rawmode.org/

Dev site: http://dev.catalyst.perl.org/


---
michael reece :: software engineer :: [EMAIL PROTECTED]


___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: Redirects // Re: [Catalyst] Re: forwarding to chained actions

2007-04-27 Thread Michael Reece
it would be nice if $c-res-redirect returned a 303 appropriately if  
$c-req-method eq 'POST'.


i have in the past trapped it in 'end' to fix up the $c-res-status  
if == 302 and $c-req-method eq 'POST', but lately i just don't bother.


On Apr 27, 2007, at 6:03 AM, Simon Wilcox wrote:


On Tue, 24 Apr 2007, A. Pagaltzis wrote:


_ALL_ POSTs should be followed by a redirect, ALWAYS.


This is really good advice but I was looking at the response code RFC
today [1] for an unrelated matter and found the following:

  If the 302 status code is received in response to a request other  
than
  GET or HEAD, the user agent MUST NOT automatically redirect the  
request

  unless it can be confirmed by the user, since this might change the
  conditions under which the request was issued.

It then goes on to say:

  Note: RFC 1945 and RFC 2068 specify that the client is not  
allowed to

  change the method on the redirected request.  However, most existing
  user agent implementations treat 302 as if it were a 303 response,
  performing a GET on the Location field-value regardless of the  
original
  request method. The status codes 303 and 307 have been added for  
servers
  that wish to make unambiguously clear which kind of reaction is  
expected

  of the client.

So, what do people do - do you send 303/307's correctly or just  
default

to 302 behaviour ?

Simon Wilcox
[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

--
Digital Craftsmen Ltd
Exmouth House, 3 Pine Street, London. EC1R 0JH
t 020 7183 1410 f 020 7099 5140 m 07951 758698
w http://www.digitalcraftsmen.net/

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/ 
catalyst@lists.rawmode.org/

Dev site: http://dev.catalyst.perl.org/


---
michael reece :: software engineer :: [EMAIL PROTECTED]



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: Shoot out -- Catalyst / RoR / Other MVC apps --

2007-05-11 Thread Michael Reece
now the next time this happens, googling for cpantools.org will find  
this thread and all will be clear!


On May 11, 2007, at 4:40 AM, A. Pagaltzis wrote:


* Daniel Hulme [EMAIL PROTECTED] [2007-05-10 23:50]:

No, but on finding it not working my first guess was that he
mistyped it, so I tried Google.


Guess what? So did I.

I just decided that leaving off the `.org` wouldn’t be useful –
though I can’t remember the thought process that led me to not
try. Normally I’m the one posting “first hit on Google if you
search for XYZ” (and usually the query in question is my first
attempt).

Never assume I didn’t google. You’ll *always* be wrong. :-)

Regards,
--
Aristotle Pagaltzis // http://plasmasturm.org/



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Re: Persistent login

2007-05-16 Thread Michael Reece
there's no especially sane way to extend the session cookie on a per- 
user basis that i have found.



here is a hack that i am experimenting with:

if ($c-login($username, $password)) {
$c-session-{remember_me} = $c-req-params-{remember_me};
# ...
}

and in package MyApp.pm (or a plugin or a subclass of the  
State::Cookie plugin or ...)


sub calculate_session_cookie_expires {
my $c = shift;
return $c-session-{remember_me}
? time() + 60 * 60 * 24 * 90   # 90 days
: $c-NEXT::calculate_session_cookie_expires(@_);
}


On May 15, 2007, at 6:47 PM, Evaldas Imbrasas wrote:


On 5/15/07, Jonathan Rockway [EMAIL PROTECTED] wrote:
Use the session plugin and set the session expiration to ... 1  
week.  If some

data needs to expire sooner than that ... expire it sooner than that.

Here's what I would do.  Create a session and log the user in.   
Store a last

login time in the user_class.  If the last_login (or last_activity;
whatever) is too long ago, delete data from the session and start  
over.


Yep, makes sense. However, even in that case, I was hoping that the
standard session/auth plugins would support this functionality without
doing anything additional in my Controller::Auth, i.e.:

if ($c-req-params-{login_remember}) {
 $c-login($email, $password, $expires_long);
} else {
 $c-login($email, $password, $expires_short);
}

Am I wrong in thinking that pretty much any decent login system has to
support this anyway?.. (This is my first Catalyst project, so I
wouldn't be surprised if there's a one-liner out there that would
solve this problem without a need for the above - sorry if that's the
case.)

--
-
Evaldas Imbrasas
http://www.imbrasas.com

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/ 
catalyst@lists.rawmode.org/

Dev site: http://dev.catalyst.perl.org/


---
michael reece :: software engineer :: [EMAIL PROTECTED]



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ActiveRecord for Perl

2007-05-22 Thread Michael Reece


On May 22, 2007, at 7:58 AM, Matt S Trout wrote:


  item = user.items.find(params[:id])


my $item = $user-items-find($item_id);


  new_item = user.items.create!(params[:item])


my $new_item = $user-items-create(\%item_info);


that's great; i thought i had recalled something similar, but  
couldn't find it again in my quick skim of DBIx::Class::Manual::*


you can get close to that with RDBO's $user-find_items() (and  
maybe DBIC

has something similarish) but the ruby way here feels so much better!


How?


personal satisfaction.




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Lightweight error/messages reporting to templates

2007-05-23 Thread Michael Reece
i don't know about 'best practice' but what i have done is create a  
plugin that exposes $c-alert_error(), $c-alert_info(), and a couple  
of similar ones.


the controller does, roughly:

  $c-alert_error('You screwed up.'); # moreorless push @{ $c-flash- 
{alert_errors} }, @_;

  $c-alert_info($obj-name . ' updated!');

these are stored in the flash (for redirect-after-successful-post).

i then populate stash/globals with the flash contents before  
rendering the view (mason in my case).


my mason autohandler then displays any @alert_errors/etc as appropriate.

i use the same system for $c-form_error(username = 'Username  
missing.'), which is deleted into %form_errors before rendering the  
view.  my custom form generators (mason components) know how to  
display those errors as appropriate when the form is rendered.




On May 23, 2007, at 11:29 AM, Paul Makepeace wrote:


I'm hoping there's a 'best practice' or common pattern for reporting
errors and messages to templates (not necessarily just forms).

I find myself doing stuff like,

my @errors; my @messages;
# ...
if ($some_err_condition) {
  push @errors, whoops;
} else {
  $obj-update;
  push @messages, $obj-name .  updated!;
}
# ...
$c-stash(messages = join br/, @messages);
$c-stash(errors = join br/, @errors);

Which is then tediously copy  pasted amongst controllers that do that
reporting.

And then my template says something like,

 [% IF errors %]
   p class=error[% errors %]/p
 [% END %]
 [% IF messages %]
   p class=messages[% messages %]/p
 [% END %]

At least with the template I have that as a MACRO I can call variously
but I'd at least like a way to have some kind of
context/controller-wide way of dealing with these errors  messages. I
don't quite understand Cat's object model well enough to do this
globally myself yet.

P

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/ 
catalyst@lists.rawmode.org/

Dev site: http://dev.catalyst.perl.org/


---
michael reece :: software engineer :: [EMAIL PROTECTED]



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Forms generation

2007-06-14 Thread Michael Reece


On Jun 14, 2007, at 9:20 AM, Bill Moseley wrote:


On Thu, Jun 14, 2007 at 11:34:52AM +0200, Leo Cacciari wrote:

   As I see it, the controller should tell the view 'I want the user
entering the following data, each one with its data-type, and obeying
the following constraints.


I take that a step further, and say that the controller should say
only I want the user to update their profile  and the controller
shouldn't have to worry what fields and field types the profile is
made up of.


i've implemented something similar to RoR-style form helpers, where  
the controller stashes the $user, and the view (mason here) does:


  | /form, for = $user, action = $c-uri_to('update_profile',  
$user-id) 

 /text, name = 'username', label = 'Email address' 
 /text, name = 'full_name' 
 /checkbox_group, name = 'opt_in', choices = [ [ 0 =  
'No'] , [ 1 = 'Yes' ] ] 

| /form:buttons 
   /submit 
   /cancel 
/
  /

and the mason components take care of populating input values (from  
object or previous request params), displaying inline errors  
(generated from Date::FV) on failed submission, all layout and field  
labeling requirements.


the end result is something like

  my $results = $self-check_form( Model::User-dfv_args_for_form 
('update_profile') );

  if ($results-has_missing || $results-has_invalid) {
return $self-form_error( $results-msgs );
  } else {
$user-update_from_hash($results-valid);
  }

i've been looking at Form::Processor and similar, but the tricky bit  
for me is that i want the view to be both responsible for generating  
the HTML and deciding which fields belong on which form, without an  
intermediate form object that has to inform both the view and  
controller.


the problem becomes giving the view a way to communicate the allowed  
fields back to the controller without trusting the client.


i've been experimenting with having my form component store the  
details in the session as its being rendered.


  | /form, for = $user, form_id = 'update_profile', ... 
 /text, name = 'username', ...!-- pushes to @{ $c- 
session-{form_fields}-{update_profile} } --

...

  my $fields = delete $c-session-{form_fields}-{update_profile};
  my $results = $self-check_form( Model::User-dfv_args_for_fields(@ 
$fields) );


i'm still teasing out the right API for this, but i do like how it  
gives authority to the view without also giving it to the client.




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] httpd.conf.

2007-06-15 Thread Michael Reece


On Jun 15, 2007, at 8:11 AM, Kyoko,Shikamata wrote:


Hi,
I'd like to execute other cgi program at /cgi-bin/.
I set the following to httpd.conf. But, I cannot execute cgi.  
Please let me know my mistake .

-
Perl
   use lib qw( /var/www/MyApp/lib );
/Perl

PerlModule MyApp

Location /
   SetHandler   perl-script
   PerlHandler  MyApp
/Location

ScriptAlias /cgi-bin/ /var/www/other
Location /cgi-bin/./Location


what's inside the . there?  SetHandler cgi-script should do the  
trick.



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] iterating ResultSet in controller vs. template

2007-06-19 Thread Michael Reece
either use iterators in both controller and template, or use array- 
refs in both, but don't try to use both at once with only one variable.



On Jun 19, 2007, at 12:09 PM, John Goulah wrote:


On 6/19/07, Michael Reece [EMAIL PROTECTED] wrote:
i believe you are getting an array-ref because you are calling it  
in list context via the [ ... ] here.


  my $myalums  = [ $c-model('MyDB::Alumni')-search({}, { rows =  
20  }) ] ;



try:

my $myalums_iter  = $c-model('MyDB::Alumni')-search({},  
{ rows = 20  });

while (my $alum = $myalums_iter-next) { ... }



You are correct (and I did explain that as well in my original post  
that was happening).  So the question is , how can I make the same  
call and access the data in both places?


pick one:

   my $myalums  = $c-stash-{alumni} = [ $c-model('MyDB::Alumni')- 
search({}, { rows = 20  }) ] ;

   foreach my $alum (@$myalums) {
  print id: , $alum-alum_id, \n;
   }
   ...
   [% FOREACH alum IN alumni -%]
   id: [% alum.alumni_id %]  br /
   [% END -%]

-or-

   my $myalums  = $c-stash-{alumni} = $c-model('MyDB::Alumni')- 
search({}, { rows = 20  });

  while (my $alum = $myalums-next) {
  print id: , $alum-alum_id, \n;
   }
  $myalums-reset;   # reset iterator!
   ...
  [%WHILE (alum = alumni.next) %]
   id: [% alum.alumni_id %]  br /
   [% END -%]




___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Announce: Last Call - RC of C::P::Authentication

2007-07-09 Thread Michael Reece
this does break my custom authentication.  i am still investigating  
why..


On Jul 7, 2007, at 12:50 PM, Jay K wrote:


Hey all,

Big news!  With the most excellent assistance of J. Shirley and
Nilson Santos Figueiredo Junior - The new C::P::Authentication
finally has all it's tests and, we feel, is ready for release.

Thus - the Release Candidate is now on CPAN at:

http://search.cpan.org/~jayk/Catalyst-Plugin- 
Authentication-0.0_02/


For those of you using custom, or unusual stores or credentials -
PLEASE TEST THIS in your config!  The update makes a lot of changes
to the internals of the authentication system, and while there is a
compatibility mode which should maintain functionality with older
modules - only a handful have actually been tested.

So again - if you have a custom store or credential, or you use
something aside from the DBIC store module and
Password credential - it's a very VERY good idea to test against the
updated C::P::Authentication module.

If nobody shouts 'stop the presses' in the next couple of days, we
will be doing a full release and bumping the CPAN version next week.

For those who have authored Stores or Credentials - it's probably a
good idea to look at:

http://tinyurl.com/3x5yu3  (C::P::A::Internals)

to better understand how the new system works and how to update your
modules for compatibility.  Modules that are not updated will
continue to work in compatibility mode, but will not allow users to
take advantage of the new Realms features.

Again, PLEASE TEST this module with your apps!  We will most likely
release mid-week if we get no bug reports!

Thanks all!

JayK

---
Those who can make you believe absurdities can make you commit
atrocities. --Voltaire



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/ 
catalyst@lists.rawmode.org/

Dev site: http://dev.catalyst.perl.org/


---
michael reece :: software engineer :: [EMAIL PROTECTED]



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Announce: Last Call - RC of C::P::Authentication

2007-07-09 Thread Michael Reece

the short answer is it does not call my store's get_user method, despite

  __PACKAGE__-config(
authentication = { store =  
'MyApp::Plugin::Authentication::DBI::User'}

  );

the error i get is:

[debug] find_user: unable to locate a store matching the requested realm


the new docs suggest that i shouldn't need to make any changes for  
backwards compatibility..?


On Jul 9, 2007, at 9:46 AM, Michael Reece wrote:

this does break my custom authentication.  i am still investigating  
why..


On Jul 7, 2007, at 12:50 PM, Jay K wrote:


Hey all,

Big news!  With the most excellent assistance of J. Shirley and
Nilson Santos Figueiredo Junior - The new C::P::Authentication
finally has all it's tests and, we feel, is ready for release.

Thus - the Release Candidate is now on CPAN at:

http://search.cpan.org/~jayk/Catalyst-Plugin- 
Authentication-0.0_02/


For those of you using custom, or unusual stores or credentials -
PLEASE TEST THIS in your config!  The update makes a lot of changes
to the internals of the authentication system, and while there is a
compatibility mode which should maintain functionality with older
modules - only a handful have actually been tested.

So again - if you have a custom store or credential, or you use
something aside from the DBIC store module and
Password credential - it's a very VERY good idea to test against the
updated C::P::Authentication module.

If nobody shouts 'stop the presses' in the next couple of days, we
will be doing a full release and bumping the CPAN version next week.

For those who have authored Stores or Credentials - it's probably a
good idea to look at:

http://tinyurl.com/3x5yu3  (C::P::A::Internals)

to better understand how the new system works and how to update your
modules for compatibility.  Modules that are not updated will
continue to work in compatibility mode, but will not allow users to
take advantage of the new Realms features.

Again, PLEASE TEST this module with your apps!  We will most likely
release mid-week if we get no bug reports!



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Announce: Last Call - RC of C::P::Authentication

2007-07-09 Thread Michael Reece

empty hashref:  {}

some details about MyApp:

use MyApp::Plugin::Authentication::DBI::User;# $c-user class

use Catalyst (
# ...
'Authentication',   # Implements $c-user
'+MyApp::Plugin::Authentication::DBI',   # Implements $c-login
# ...
);

__PACKAGE__-config(
# ...
authentication = { store =  
'MyApp::Plugin::Authentication::DBI::User' },

# ...
);


'sub login' is implemented in MyApp::Plugin::Authentication::DBI, and  
does

my $user_obj = $c-get_user($user, $password);

which i expect to ultimately call  
MyApp::Plugin::Authentication::DBI::User-get_user() but it does not.


a 'warn Data::Dump::dump($c-auth_realms);' just before $c-get_user  
yields {}



On Jul 9, 2007, at 11:40 AM, Jay K wrote:


Hi Michael,

Can you tell me what $c-auth_realms returns?

Thanks,

JayK

On Jul 9, 2007, at 12:34 PM, Michael Reece wrote:


the short answer is it does not call my store's get_user method,
despite

  __PACKAGE__-config(
authentication = { store =
'MyApp::Plugin::Authentication::DBI::User'}
  );

the error i get is:

[debug] find_user: unable to locate a store matching the requested
realm


the new docs suggest that i shouldn't need to make any changes for
backwards compatibility..?

On Jul 9, 2007, at 9:46 AM, Michael Reece wrote:


this does break my custom authentication.  i am still
investigating why..

On Jul 7, 2007, at 12:50 PM, Jay K wrote:


Hey all,

Big news!  With the most excellent assistance of J. Shirley and
Nilson Santos Figueiredo Junior - The new C::P::Authentication
finally has all it's tests and, we feel, is ready for release.

Thus - the Release Candidate is now on CPAN at:

http://search.cpan.org/~jayk/Catalyst-Plugin-
Authentication-0.0_02/

For those of you using custom, or unusual stores or credentials -
PLEASE TEST THIS in your config!  The update makes a lot of changes
to the internals of the authentication system, and while there is a
compatibility mode which should maintain functionality with older
modules - only a handful have actually been tested.

So again - if you have a custom store or credential, or you use
something aside from the DBIC store module and
Password credential - it's a very VERY good idea to test against  
the

updated C::P::Authentication module.

If nobody shouts 'stop the presses' in the next couple of days, we
will be doing a full release and bumping the CPAN version next  
week.


For those who have authored Stores or Credentials - it's probably a
good idea to look at:

http://tinyurl.com/3x5yu3  (C::P::A::Internals)

to better understand how the new system works and how to update  
your

modules for compatibility.  Modules that are not updated will
continue to work in compatibility mode, but will not allow users to
take advantage of the new Realms features.

Again, PLEASE TEST this module with your apps!  We will most likely
release mid-week if we get no bug reports!



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/
catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


---
May we not return to those scoundrels of old, the illustrious
founders of superstition and fanaticism, who first took the knife
from the altar to make victims of those who refused to be their
disciples. - Voltaire




---
michael reece :: software engineer :: [EMAIL PROTECTED]



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] html::prototype syntax in new Cat version

2007-07-10 Thread Michael Reece
i may be the exception, but i have no hesitation in using perl (or  
other templating languages) to generate html, javascript, css, or  
even more perl.


it may be harder to debug, but the productivity gains are worth it.

i think RoR's rjs stuff is really keen, too.

On Jul 10, 2007, at 10:08 AM, Daniel McBrearty wrote:


It's been said by others but I really prefer to do all
this in my templates.  It would be easy to have this
in a Template Toolkit plugin if you wanted, but I
can't see the value of basically using perl as a code
generator for Javascript.  I prefer to be closer to


my sentiments exactly. Even if your perl is way better than your js,
it's harder to debug js wrapped in perl than straight js. You usually
have to face the underlying library sooner or later.

--
Daniel McBrearty



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] firing a POST method with Test::WWW::Mechanize

2007-08-06 Thread Michael Reece

Test::WWW::Mechanize isa LWP::UserAgent, so why not..

  # like LWP docs..
  my $req = HTTP::Request-new(POST = $uri);
  $req-content_type('application/x-www-form-urlencoded');
  $req-content('foo=baromg=lol');

  $mech-request($req);
  ok($mech-success, 'POST succeeded');



On Aug 6, 2007, at 9:24 AM, Daniel McBrearty wrote:


I want to do this by just making the POST request (not telling $mech
to click/submit somewhere). I don't see any obvious way of doing it.

any ideas?

D

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/ 
catalyst@lists.rawmode.org/

Dev site: http://dev.catalyst.perl.org/


---
michael reece :: software engineer :: [EMAIL PROTECTED]



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Method to overload per request

2007-08-09 Thread Michael Reece
by several times per page load are you referring to multiple  
requests to render one page?  (ie, if you have your css/js/etc served  
through your app)


On Aug 9, 2007, at 8:04 AM, John Lifsey - Contractor - wrote:

Is there a method in C::Req (or any other part of Cat) that I can  
overload which is called only once per request? I thought that  
would be prepare, but it seems that is called several times per  
page load. Any advice appreciated.


John



___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/