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:


  use MyApp;


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] Re: Last Chance / Last Day: Web development platform contest and Perl / Catalyst

2006-12-04 Thread Michael Reece
that works fine if you already have it installed, perhaps.  but  
here's what a lot of people do:


start from:  http://search.cpan.org/search?query=catalyst

click Catalyst:  http://search.cpan.org/~mramberg/Catalyst- 
Runtime-5.7006/


scroll down to Documentation, and click Catalyst::Manual: http:// 
search.cpan.org/~mramberg/Catalyst-Runtime-5.7006/lib/Catalyst/ 
Manual.pod


find out there is a Tutorial.  click Catalyst::Manual::Tutorial:  
http://search.cpan.org/perldoc?Catalyst%3A%3AManual%3A%3ATutorial


and get a big "Not found" from search.cpan.org




On Dec 3, 2006, at 1:57 AM, Jonathan Rockway wrote:

try "perldoc What::You::Want::To::Read"; I think you'll find it  
works well.


___
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] 404 Not Found

2006-12-21 Thread Michael Reece

i've been using something like the following, which may work for you:

DocumentRoot /path/to/root/static/

## Next, alias /static/ back to the DocumentRoot so /static/foo  
comes from the static/ directory.

Alias "/static/" /path/to/root/static/

RewriteEngine On
## Rewrite known static files to /static/ which (because of the  
above Alias) will be served from DocumentRoot

RewriteRule ^/favicon.ico /static/favicon.ico [L,R]
RewriteRule ^/robots.txt /static/robots.txt [L,R]


SetHandler perl-script
PerlHandler MyApp



SetHandler default-handler



On Dec 21, 2006, at 10:17 AM, Octavian Rasnita wrote:



Why even allow apache to know that root/ exists?  Set the docroot to
root/static/ or something.


I wanted to do that, but I have seen that the file favicon.ico is  
put in /root, and I thought that this directory should be defined  
as DocumentRoot in httpd.conf because of that.
Of course I can move the file favicon.ico, but I wanted to use the  
most "default" configuration.


Teddy


___
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::Controller::FormBuilder config problem

2006-12-21 Thread Michael Reece
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.


On Dec 21, 2006, at 6:54 AM, Juan Camacho wrote:


On 12/21/06, Ulrich Leodolter <[EMAIL PROTECTED]> wrote:

Hi,

The config method as described in Catalyst::Controller::FormBuilder
doesn't work for me.

in MyApp.pm



RTM.

You have the config options in the wrong place.  Put them in your
Controller class -- not in MyApp.pm.  I recommend you create a
MyApp::Controller::Base class and put it there and then have your
controller's inherit from it.

I tested the stylesheet option with the latest version
CGI::FormBuilder and Catalyst::Runtime and it works for me.

___
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] 404 Not Found

2007-01-02 Thread Michael Reece
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? ;)


On Jan 2, 2007, at 6:30 AM, Matt S Trout wrote:



On 22 Dec 2006, at 02:13, Octavian Rasnita wrote:

Ok, well I thought that the default things in Catalyst are the  
recommended for some reasons, but I see that it is not really so.


Not exactly true; the defaults are usually pretty sane and I tend  
to mostly stick to them for stuff like root/ - however there's a  
big difference between 'default' and 'must do it this way or your  
computer will catch fire' - we do our best to let you organise  
stuff how -you- want to rather than how we think you're going to  
want to. This is probably also why very few cat contribs use  
windows by choice ;)


--
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] 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] 404 Not Found

2007-01-02 Thread Michael Reece


On Jan 2, 2007, at 9:55 AM, Matt S Trout wrote:



On 2 Jan 2007, at 17:45, Michael Reece wrote:

will things break if i delete the Makefile.PL and define a home in  
the config?


if so, then my problem is solved!


Nothing should break at all, although if you want to put the home  
in the config -file- you'll need to make sure ConfigLoader can find  
it - see the ConfigLoader docs for details of how to do that.


i am not using a config file, but thanks for the pointer.



I dunno about your problem being -solved- though - I'd argue that  
so far all we're seeing is symptoms of the underlying problem "I  
haven't read enough documentation yet" (or possibly "we don't have  
pointers in the right places in the docs for you to find them", in  
which case I'd love to see a patch adding links to the places you  
looked and didn't find this info :)




the places i looked are the pod docs for Catalyst.pm,  
Catalyst::Manual::*, grepping through everything under site_perl/ 
5.8.8/Catalyst/*, and searching http://dev.catalystframework.org/wiki/


i found a mention of Makefile.PL on http://dev.catalystframework.org/ 
wiki/SolvedIssues but its solution is "make sure to put at least an  
empty Makefile.PL or Build.PL in the application top directory" which  
is not quite what i was after.


i still haven't found it in the docs, so i am not sure what such a  
patch would point exactly!



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


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

2007-01-02 Thread Michael Reece

that did it!  can you help me understand why?

should a similar syntax be used in place of __PACKAGE__->config-> 
{bindlex}{Param} = ... ?


On Jan 2, 2007, at 11:16 AM, Matt S Trout wrote:



On 2 Jan 2007, at 19:07, Michael Reece wrote:


narrowed this down to a failure even with:

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


Try changing the line in Root.pm that does

__PACKAGE__->config->{namespace} = '';

to

__PACKAGE__->config(namespace => '');

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


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


[Catalyst] Operation "eq": no method found, ... Dispatcher.pm line 377

2007-01-22 Thread Michael Reece
i am getting intermittent errors (under mod_perl; Catalyst version  
5.7003) from $c->dispatcher->uri_for_action:


Operation "eq": no method found, left argument in overloaded package  
URI::_generic, right argument has no overloaded magic at /usr/local/ 
lib/perl5/site_perl/5.8.8/Catalyst/Dispatcher.pm line 377


sub uri_for_action {
my ( $self, $action, $captures) = @_;
$captures ||= [];
foreach my $dispatch_type ( @{ $self->dispatch_types } ) {
my $uri = $dispatch_type->uri_for_action( $action, $captures );
return( $uri eq '' ? '/' : $uri )   # line 377
if defined($uri);
}
return undef;
}


i am calling $c->dispatcher->uri_for_action like so:

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;
}


any ideas?

---
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] Operation "eq": no method found, ... Dispatcher.pm line 377

2007-01-22 Thread Michael Reece


On Jan 22, 2007, at 1:30 PM, John Napiorkowski wrote:



--- Michael Reece <[EMAIL PROTECTED]> wrote:


i am getting intermittent errors (under mod_perl;
Catalyst version
5.7003) from $c->dispatcher->uri_for_action:

Operation "eq": no method found, left argument in
overloaded package
URI::_generic, right argument has no overloaded
magic at /usr/local/
lib/perl5/site_perl/5.8.8/Catalyst/Dispatcher.pm
line 377

sub uri_for_action {
 my ( $self, $action, $captures) = @_;
 $captures ||= [];
 foreach my $dispatch_type ( @{
$self->dispatch_types } ) {
 my $uri = $dispatch_type->uri_for_action(
$action, $captures );
 return( $uri eq '' ? '/' : $uri )  # line
377
 if defined($uri);
 }
 return undef;
}


i am calling $c->dispatcher->uri_for_action like so:

 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;
 }


any ideas?

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


Hi,

This may not help you at all but I don't think you if
all you want is the URI for a given action that this
is the method to use.  Typically I use the $c->uri_for
and controller->action_for methods.  This works pretty
well for me.

my $uri =
$c->uri_for($c->controller(xxx)->action_for('action
private name');

If you just need the uri for an action in the current
controller and action you can make it even shorter:

my $uri = $c->uri_for($c->action);

or for a different action in the same controller:

my $uri =
$c->uri_for($c->controller->action_for('action name');

I think there are even easier ways to do this, might
want to search the archives.

Can you give me a few more details about your use case
and setup and then maybe I can understand what the
best way to solve your problem is.

--John



can you tell me where $c->controller->action_for is documented?

http://search.cpan.org/~mramberg/Catalyst-Runtime-5.7006/lib/Catalyst/ 
Controller.pm is rather blank.


my specific use case here is

  my $uri = $c->uri_to('/some/controller/method', @path_args, {% 
query_args}, [EMAIL PROTECTED]);


i convert the $path '/some/controller/method' to an action using $c- 
>dispatcher->get_action_by_path, and then get the uri for the  
$action via $c->dispatcher->uri_for_action as mentioned at


http://search.cpan.org/~mramberg/Catalyst-Runtime-5.7006/lib/ 
Catalyst.pm#%24c-%3Euri_for(_%24path%2C_%40args%3F%2C_%5C% 
25query_values%3F_)


i will take a look at action_for and see if it will do what i want.   
looks like i would first have to transform '/some/controller/method'  
into 'Some::Controller' + 'method', which would work for most cases,  
except when the controller namespace differs from the package  
namespace (ie, Controller/Root.pm) .. those contortions are what  
makes $c->dispatcher->get_action_by_path attractive, but the question  
remains why that sometimes returns $actions (with truthiness) that  
cause uri_for_action($action) to die ..






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


[Catalyst] $c->detach and $c->action

2007-01-31 Thread Michael Reece
is there something like detach that will also set the current  
'action' to the one being detached to?



my MyApp::C::Root->end does something like

if (!$c->stash->{template}) {
  $c->stash->{template} = $c->action->namespace . '/' . $c->action- 
>name . '.html';

}

and my wish is to be able to detach to another action in such a way  
that by the time 'end' is called, $c->action points to the new  
action, so that the calling/original action need not explicitly  
specify the template that would have been the default had the new  
action been the original action (what a horrid sentence -- my  
apologies!).


i'm trying to find a way to do this without re-doing all the hard  
work that forward() does to determine the proper action to execute..


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] 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] Shoot out -- Catalyst / RoR / Other MVC apps --

2007-05-08 Thread Michael Reece


On May 8, 2007, at 8:17 AM, Matt S Trout wrote:


On Tue, May 08, 2007 at 03:24:15PM +0100, Luis Azevedo wrote:


What I still not understand is why he says RoR isn't MVC O:).


Because their "models" are dumb data objects and they shove all the  
business

logic into what they call the controller.


that depends on the application implementation, does it not?  i  
haven't yet seen anything that prevents putting the business logic  
and 'create_user' code in the ActiveRecord models.  care to elaborate?



This is bloody important for building good application architecture  
- a cron
script or e-mail gateway should be able to invoke e.g. a create  
user function

in the model without ever having to load the web-related code. If your
create user logic is in the controller, you're stuck with either  
talking to the

app over HTTP or simulating a request.


this sort of design misstep can be achieved in Catalyst or RoR, so i  
suspect there must be something more to your story that i'm not getting.



___
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] Shoot out -- Catalyst / RoR / Other MVC apps --

2007-05-08 Thread Michael Reece


On May 8, 2007, at 8:39 AM, Dave Rolsky wrote:


On Tue, 8 May 2007, Perrin Harkins wrote:
...
One consequence of doing MVC the "right" way, though, is that you  
tend to up with rather large and complex sets of model classes.  
This doesn't bother me, but it's definitely the case that I end up  
with the bulk of my application's code in the model.


indeed.  if we're still talking about RoR, i think http:// 
weblog.jamisbuck.org/2006/10/18/skinny-controller-fat-model is a good  
intro to the concept.



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



___
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] ActiveRecord for Perl

2007-05-22 Thread Michael Reece


On May 22, 2007, at 9:43 AM, Matt S Trout wrote:


On Tue, May 22, 2007 at 09:29:25AM -0700, Michael Reece wrote:


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::*


[...]


Given that you now know that, would you be willing to consider  
contributing
any features you consider missing in DBIx::Class rather than  
writing another

implementation of essentially the same API?


i am not the OP for this thread, and i have no intentions of writing  
a general purpose ORM!  though i have been mucking with RoR and find  
the comparisons interesting.  i may look at DBIC again next project.




(DBIC is intentionally not
opinionated to let people do things their way with it - there are  
more than
enough perl ORM projects already and I wanted to provide something  
people could

subclass/extend rather than have to re-invent again :)

--
  Matt S Trout   Need help with your Catalyst or  
DBIx::Class project?




___
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 "", @messages);
$c->stash(errors => join "", @errors);

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

And then my template says something like,

 [% IF errors %]
   [% errors %]
 [% END %]
 [% IF messages %]
   [% messages %]
 [% 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: plugins; was Re: [Catalyst] debug mode

2007-06-05 Thread Michael Reece


On Jun 5, 2007, at 12:33 PM, Matt S Trout wrote:


On Tue, Jun 05, 2007 at 08:04:03AM -0700, [EMAIL PROTECTED] wrote:
if the catalyst base controller class provided an easy way to  
access $c

from a utility method (vs an action method, which receives $c
'automatically'), then i think plugins might be a little less  
popular.


Well, you can already do $self->_app to get the application.


but that holds only the class, right?  ie, "MyApp"



  sub _ACTION : Pricvate {
my ($self, $c) = @_;
$self->_context($c);
$self->SUPER::_ACTION($c);
  }


That's not only in the wrong place to work for begin/end/auto it  
screws up

the destruction process and is therefore really really dangerous.


i had a feeling it was less than ideal, which is why i threw it out  
there.  can you clarify what you mean about the destruction process?   
i don't see anything special in ACCEPT_CONTEXT.pm to deal with that..




http://search.cpan.org/~jrockway/Catalyst-Component- 
ACCEPT_CONTEXT-0.02/lib/Catalyst/Component/ACCEPT_CONTEXT.pm


is an already extant, non-buggy version.

Don't Reinvent The Wheel :)


but but!  my (buggy) code pre-dates this CPAN wheel by about 4 months ;)

i'll try swapping this in and see how it goes, 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] 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', ... &>   

...

  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 .

-

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


PerlModule MyApp


   SetHandler   perl-script
   PerlHandler  MyApp


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


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
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) { ... }


On Jun 19, 2007, at 11:16 AM, John Goulah wrote:




On 6/19/07, John Napiorkowski <[EMAIL PROTECTED]> wrote:

--- John Goulah <[EMAIL PROTECTED]> wrote:

> If I do something simple like this:
>
>  my $myalums  = [
> $c->model('MyDB::Alumni')->search({}, { rows => 20
> })
> ] ;
>
> and stash it:
> $c->stash->{alumni} = $myalums;
>
> I am able to iterate in the template like:
>
>[% FOREACH alum IN alumni -%]
>id: [% alum.alumni_id %]  
>[% END -%]
>
>
> But if I try to iterate this in the controller, I
> cannot do something like:
>
> while (my $alum = $myalums->next) {
> $c->log->debug("id: ". $alum->alumni_id);
> }

Because ->next isn't a method on an array reference.
You could try derefing via @$myalumns.


I have tried a few things here.  I can get this to work:


for my $element (@{$myalums}) {
$c->log->debug("alum:". $element->alumni_id);
}


but not :

while (my $alum = @{$myalums}->next) {
$c->log->debug("id: ". $alum->alumni_id);
}

In this case I get:
Can't call method "next" without a package or object reference


I'm assuming I'm just doing something obviously wrong here?

Thanks!
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/


---
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] 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 %]  
   [% 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 %]  
   [% 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=bar&omg=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/