Re: [Catalyst] So, what do we want in the -next- book?

2008-04-29 Thread Matthew Pitts
On Tue, 2008-04-29 at 12:06 -0500, Cory Watson wrote:
 On Tue, Apr 29, 2008 at 9:51 AM, J. Shirley [EMAIL PROTECTED]
 wrote:
 Dare I say, an Enlightened Perl Development book?
 
 
 
 Being in the middle of 5 or 6 apps that all use the 'enlightened'
 stack of perl libraries I can personally say that I would _love_ to
 have this book to recommend to our developers or to others.
 
 
 I love DBIC, Catalyst, Moose and friends because they don't force me
 into a particular way of doing things.  The problem with this approach
 is that, for the newb, there are so many choices to make.  It's not
 always clear which is the best.  I know I've made -- and continue to
 make -- bad choices that I later have to undo.  A guide into this area
 of perl would likely be very helpful.

++

I've been using Perl for many years with the last two being professional
and I'm just now becoming somewhat aware of what the enlightened
libraries are. I stumble in this area a lot.

A book into this area as a whole would be very nice.

v/r

-matt pitts

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


[Catalyst] PAR deployment w/ non-standard layout

2008-02-05 Thread Matthew Pitts
Due to our initial development effort being broken down b/t code and
design, our application has somewhat of a non-standard layout. I'm now
looking to use PAR to deploy the app, but I'm having some issues due to
our non-standard setup and I'm hoping someone can shed some light on the
magic behind 'make catalyst_par'.

Does the built PAR contain all of the app's root content? I've built
some test PARs and I can't find where it has this content included.
However, when I run a test server via a PAR and browse the
the /tmp/par-... directory that contains the app I find the
inc/lib/MyApp/root directory that contains all such rootness.

If the PAR doesn't get built with root inside, then does it copy
root into the /tmp/par-... directory when it is run via 'parl
myapp.par script/myapp_server.pl'?

Are there still issues with PAR's /tmp/par-... magic in a FCGI setup
with multiple versions of the same app?
Reference: http://www.gossamer-threads.com/lists/catalyst/users/11148
I want to be able to run my UAT and PROD apps on the same system, but
obviously they would need different home directories.

Can I use myapp.par as a FCGI internal process in mod_fcgid? Would I
just replace my Apache directive references to 'script/myapp_fastcgi.pl'
with 'parl myapp.par script/myapp_fastcgi.pl'?

Are there any issues with using the following for mod_fcgid to support
my non-standard layout:
'CATALYST_HOME=/path/to/home parl myapp.par script/myapp_fastcgi.pl'?

TIA for any help.

Regards,
-matt pitts

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


[Catalyst] MyApp::C::PageHooks - thoughts ?

2007-10-29 Thread Matthew Pitts
I wanted to get some thoughts on something a little different that I'm
doing...

What I want to to have is Controllers that are temporary (i.e. date
sensitive) that represent a particular promotion that's running on a
site. This promotion may need to affect different areas of the site, but
I don't want to have $c-forward calls like the following everywhere
that I need the Promo's code to inject stash data.

$c-forward('Controller::Promos::Foo', 'some_action') 

So, I decided to do a form of hooks within my app so that any given
controller can affect the stash for a defined set of hooks.

Below is the first run of my code to implement this. Basically, I
override Controller-register_actions and run through all the
controllers looking for C-config-{pagehooks} and build a local hashref
containing the hook definitions.

Then, in all the places throughout the app that are defined as
hookable I just do a:

$c-forward('Controller::PageHooks', 'run_hook', 'hook_name', [ 'arg1',
'arg2' ]);

and it just works.

The main advantage with is that I can remove the promo's controller and
don't need to change any other controllers. I can even get my design
guys to code their templates in such a way that when the promo expires,
every place on the site affected by the promo magically goes back to
pre-promo look-and-feel.

Any thoughts on my level of sanity here?

package MyApp::Controller::PageHooks;
use base 'Catalyst::Controller';

use strict;
use warnings;

my $HOOKS = {};

sub register_actions {
my $self = shift;
my ( $c ) = @_;

$self-register_hooks($c);

return $self-SUPER::register_actions(@_);
}

sub register_hooks {
my ( $self, $c ) = @_;

my @ctrls = $c-controllers;

foreach my $ctrl (@ctrls) {
my $ctrl_ref = $c-controller($ctrl);

if ( $ctrl_ref-config-{pagehooks} ) {
my $hook = $ctrl_ref-config-{pagehooks};
while ( my ($hook, $action) = each(%{$hook}) ) {
$HOOKS-{$hook} ||= ();
push @{$HOOKS-{$hook}}, [ $ctrl, $action ];
}
}
}
}

sub run_hook : Private {
my ( $self, $c, $hook, @args ) = @_;

if ( $hook  $HOOKS-{$hook} ) {
foreach my $action_ref (@{$HOOKS-{$hook}}) {
my $ctrl = $c-controller($action_ref-[0]);
my $act  = $ctrl-action_for($action_ref-[1]);

if ( $ctrl  $act ) {
$c-forward($action_ref-[0], $action_ref-[1], [EMAIL 
PROTECTED]);
}
}
}
}

1;

-- 
Matthew W. Pitts
Software Engineer
[EMAIL PROTECTED]
336.202.3913 (mobile)

A3 IT Solutions, LLC
www.a3its.com



___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/
Dev site: http://dev.catalyst.perl.org/