[Catalyst] Trailing undef in uri_for()
In a template I was using: c.uri_for( 'path', arg1, arg2 ); where arg1 and arg2 are sometimes not defined. In that case uri_for generates a url with two trailing slashes. Is there a reason to keep that behavior or should uri_for pop any undefined items off @args? -- 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/
Re: [Catalyst] debug mode
> On Mon, Jun 04, 2007 at 12:55:38PM -0700, Dylan Vanderhoof wrote: >> Oh, missed this email. Yours looks better than mine. =) > > Except for being a performance hit on every single method call on $c > (there's > a reason I keep telling people not to make everything a plugin ...). does *{"$class\::debug"} = sub { 1 }; somehow avoid this performance hit? or are you talking about the extra call to $c->config? >> > -Original Message- >> > From: Matthew Pitts [mailto:[EMAIL PROTECTED] >> > Sent: Monday, June 04, 2007 8:23 AM >> > To: The elegant MVC web framework >> > Subject: RE: [Catalyst] debug mode >> > >> > >> > I wrote a cheap little plugin for my app to override >> > $c->debug to return >> > the debug flag from $c->config->{debug}. As such: >> > >> > package MyApp::Plugin::DebugMode; >> > >> > sub debug { >> > my $c = shift; >> > >> > return $c->config->{debug} || 0; >> > } >> > >> > 1; >> > >> > Then I just add a "debug: 1" line to my DEV/QA/UAT configs and make it >> > "debug: 0" for my PROD config. It's been working pretty well for me. >> > >> > Enjoy, >> > >> > Matt Pitts ___ 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::Plugin::Session, Facebook, and Custom Session ids
On Mon, Jun 04, 2007 at 11:44:50AM -0400, Jim Spath wrote: > Is there any way to disable the validation of session ids? Seems like > it would be a somewhat useful option for those cases (like interfacing > with Facebook), where the session ids are pre-created. sub validate_session_id { 1 } might work. But don't blame me if it breaks something :) -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical DirectorWant a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ ___ 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] running a function once on all requests
On Mon, Jun 04, 2007 at 02:57:37PM -0400, Steve Francia wrote: > Eden Cardim wrote: > > On 6/4/07, Steve Francia <[EMAIL PROTECTED]> wrote: > >> Anyone know of any good reason to do it differently, or has anyone used > >> other strategies in the past? > > > > That looks like auto-chaining, you might want to take a look at "auto" > > actions. > > > > http://search.cpan.org/~jrockway/Catalyst-Manual-5.700701/lib/Catalyst/Manual/Intro.pod#Built-in_actions_in_controllers/autochaining > > > > http://dev.catalystframework.org/wiki/FlowChart > > > It does look like auto-chaining, so perhaps I should restate my original > question. > > What I want to do is a bit more specific. > I am using chaining a decent amount, often chaining across different > controllers. > > The end result of what I want to do is pass into the template (TT) the > top most level controller name IE the controller closest to root. > This is accessed using $c->namespace, from within the controller. > > If I use auto-chaining like: > > sub auto : Private { > my ( $self, $c ) = @_; > $c->stash->{ controller } = $c->namespace; > } See http://search.cpan.org/perldoc?Catalyst::ActionChain $c->action->chain->[0]->namespace (note: only valid for :Chained, anything else leaves $c->action a vanila Catalyst::Action object so check ->isa first) -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical DirectorWant a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ ___ 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] debug mode
On Mon, Jun 04, 2007 at 05:47:32PM -0400, John Goulah wrote: > Did you have to do anything in lib/MyApp.pm to get this to work? It seems > I would want to add this plugin, but Catalyst cant find it. I'm probably > doing something very obviously wrong, but I havent tried to write my own > plugins yet: > > in lib/MyApp.pm: > > use Catalyst qw/ +MyApp::Plugin::DebugMode > ... > /; The + is important. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical DirectorWant a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ ___ 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] debug mode
On Mon, Jun 04, 2007 at 12:55:38PM -0700, Dylan Vanderhoof wrote: > Oh, missed this email. Yours looks better than mine. =) Except for being a performance hit on every single method call on $c (there's a reason I keep telling people not to make everything a plugin ...). > > -Original Message- > > From: Matthew Pitts [mailto:[EMAIL PROTECTED] > > Sent: Monday, June 04, 2007 8:23 AM > > To: The elegant MVC web framework > > Subject: RE: [Catalyst] debug mode > > > > > > I wrote a cheap little plugin for my app to override > > $c->debug to return > > the debug flag from $c->config->{debug}. As such: > > > > package MyApp::Plugin::DebugMode; > > > > sub debug { > > my $c = shift; > > > > return $c->config->{debug} || 0; > > } > > > > 1; > > > > Then I just add a "debug: 1" line to my DEV/QA/UAT configs and make it > > "debug: 0" for my PROD config. It's been working pretty well for me. > > > > Enjoy, > > > > Matt Pitts > > > > On Mon, 2007-06-04 at 15:51 +0100, mark wrote: > > > I thought a nice way would be to be able to specify it in the config > > > file; then your _local.yml file could add it for the dev > > environment. > > > Yet to produce a patch for that though it should be pretty straight > > > forwards. > > > > > > Mark > > > > > > > > > > > __ > > > From: John Goulah [mailto:[EMAIL PROTECTED] > > > Sent: 04 June 2007 15:32 > > > To: The elegant MVC web framework > > > Subject: [Catalyst] debug mode > > > > > > > > > > > > What is the best way to deal with the -Debug flag between a > > production > > > and development environment? Obviously its not desirable to go into > > > the file and remove the flag every time the code goes to > > prod. I see > > > you can start the stanalone server with -d to force debug. > > I think I > > > remember about an environment variable to set debug also. Is the > > > preferred method to take the hardcoded flag out and use one > > of these, > > > or is there another way (such as a config option)? How are people > > > dealing with this? > > > > > > 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/ > > > > ___ > > 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/ -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical DirectorWant a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ ___ 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] debug mode
On Mon, Jun 04, 2007 at 10:32:07AM -0400, John Goulah wrote: > What is the best way to deal with the -Debug flag between a production and > development environment? Obviously its not desirable to go into the file > and remove the flag every time the code goes to prod. I see you can start > the stanalone server with -d to force debug. I think I remember about an > environment variable to set debug also. Is the preferred method to take the > hardcoded flag out and use one of these, or is there another way (such as a > config option)? How are people dealing with this? -Debug is mostly a "this is still in early dev" convenience; I'd take it out before first deployment and use -d or the MYAPP_DEBUG/CATALYST_DEBUG env vars from then on. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical DirectorWant a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/ ___ 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] debug mode
On 6/4/07, Matthew Pitts <[EMAIL PROTECTED]> wrote: I wrote a cheap little plugin for my app to override $c->debug to return the debug flag from $c->config->{debug}. As such: package MyApp::Plugin::DebugMode; sub debug { my $c = shift; return $c->config->{debug} || 0; } 1; Then I just add a "debug: 1" line to my DEV/QA/UAT configs and make it "debug: 0" for my PROD config. It's been working pretty well for me. Did you have to do anything in lib/MyApp.pm to get this to work? It seems I would want to add this plugin, but Catalyst cant find it. I'm probably doing something very obviously wrong, but I havent tried to write my own plugins yet: in lib/MyApp.pm: use Catalyst qw/ MyApp::Plugin::DebugMode ... /; when I start the server: Can't locate Catalyst/Plugin/MyApp/Plugin/DebugMode.pm in @INC 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/
Re: [Catalyst] running a function once on all requests
--- Steve Francia <[EMAIL PROTECTED]> wrote: > Eden Cardim wrote: > > On 6/4/07, Steve Francia <[EMAIL PROTECTED]> wrote: > >> Anyone know of any good reason to do it > differently, or has anyone used > >> other strategies in the past? > > > > That looks like auto-chaining, you might want to > take a look at "auto" > > actions. > > > > > http://search.cpan.org/~jrockway/Catalyst-Manual-5.700701/lib/Catalyst/Manual/Intro.pod#Built-in_actions_in_controllers/autochaining > > > > http://dev.catalystframework.org/wiki/FlowChart > > > It does look like auto-chaining, so perhaps I should > restate my original > question. > > What I want to do is a bit more specific. > I am using chaining a decent amount, often chaining > across different > controllers. > > The end result of what I want to do is pass into the > template (TT) the > top most level controller name IE the controller > closest to root. > This is accessed using $c->namespace, from within > the controller. > > If I use auto-chaining like: > > sub auto : Private { > my ( $self, $c ) = @_; > $c->stash->{ controller } = $c->namespace; > } > > in the root controller (Root.pm). It works until I > chain across more > than one controller. > Instead of the first, it gives me last controller in > the chain, which > leads me to believe that this method is either > called once for each > controller or called only once, but from the last > controller in the chain. > > Perhaps there is a different approach with > autochaining I should try. I've found similar things when using actions across controllers with Chained actions. If you have a chained private path the spans more than one controller it's the controller that owns the terminating action that is associated with $c->controller, not the root of the chain. This caused me trouble once as well; I guess for me it was more intuitive that way always I can't rationally defend it as better than the way it actually works. At least the auto and chained action behavior is consistent. One thing that might bite you here is that to me it sounds like you are tying the controller a bit too tightly to your view logic. Because it sounds like you are performing some sort of logic in the view based on the controller name. I don't know your exact need so I could be totally wrong here, but I thought to mention it. It could work better for you in the end to decouple the view and controller and if you need to access some logic or data in the view that resides in the controller using an intermediary class might be better. Anyway, I'd be interested to here more about your application! Thanks, John __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.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/
Re: [Catalyst] running a function once on all requests
On 6/4/07, Steve Francia <[EMAIL PROTECTED]> wrote: Instead of the first, it gives me last controller in the chain, which leads me to believe that this method is either called once for each controller or called only once, but from the last controller in the chain. It runs for all controllers in the hierarchy, top-most first. Even if it ran the other way around, you'd still get the wrong result because you're calling $c->namespace, which gives you the namespace of the current running action, you want $self->namespace instead. Perhaps there is a different approach with autochaining I should try. you could do something like: sub auto : Private { my($self, $c) = @_; push @{$c->stash->{controllers}}, $self->namespace; return 1; } # in Root sub end : Private { my($self, $c) = @_; $c->stash{controller} = $c->stash->{controllers}[0]; } Although I'm not sure if this is the best way to do it, I'd much prefer this over subclassing since things can get messy if you need to inherit from another controller like FormBuilder or REST. -- Eden Cardim Instituto Baiano de Biotecnologia Núcleo de Biologia Computacional e Gestão de Informações Biotecnológicas Laboratório de Bioinformática ___ 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] debug mode
Oh, missed this email. Yours looks better than mine. =) -D > -Original Message- > From: Matthew Pitts [mailto:[EMAIL PROTECTED] > Sent: Monday, June 04, 2007 8:23 AM > To: The elegant MVC web framework > Subject: RE: [Catalyst] debug mode > > > I wrote a cheap little plugin for my app to override > $c->debug to return > the debug flag from $c->config->{debug}. As such: > > package MyApp::Plugin::DebugMode; > > sub debug { > my $c = shift; > > return $c->config->{debug} || 0; > } > > 1; > > Then I just add a "debug: 1" line to my DEV/QA/UAT configs and make it > "debug: 0" for my PROD config. It's been working pretty well for me. > > Enjoy, > > Matt Pitts > > On Mon, 2007-06-04 at 15:51 +0100, mark wrote: > > I thought a nice way would be to be able to specify it in the config > > file; then your _local.yml file could add it for the dev > environment. > > Yet to produce a patch for that though it should be pretty straight > > forwards. > > > > Mark > > > > > > > __ > > From: John Goulah [mailto:[EMAIL PROTECTED] > > Sent: 04 June 2007 15:32 > > To: The elegant MVC web framework > > Subject: [Catalyst] debug mode > > > > > > > > What is the best way to deal with the -Debug flag between a > production > > and development environment? Obviously its not desirable to go into > > the file and remove the flag every time the code goes to > prod. I see > > you can start the stanalone server with -d to force debug. > I think I > > remember about an environment variable to set debug also. Is the > > preferred method to take the hardcoded flag out and use one > of these, > > or is there another way (such as a config option)? How are people > > dealing with this? > > > > 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/ > > ___ > 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] debug mode
You can put the following in MyApp.pm: # Allow debug to be set via myapp_local.yml sub debug { __PACKAGE__->config->{debug} } Then setting debug: 1 in the yaml file will use debug mode. -D -Original Message- From: mark [mailto:[EMAIL PROTECTED] Sent: Monday, June 04, 2007 7:51 AM To: 'The elegant MVC web framework' Subject: RE: [Catalyst] debug mode I thought a nice way would be to be able to specify it in the config file; then your _local.yml file could add it for the dev environment. Yet to produce a patch for that though it should be pretty straight forwards. Mark _ From: John Goulah [mailto:[EMAIL PROTECTED] Sent: 04 June 2007 15:32 To: The elegant MVC web framework Subject: [Catalyst] debug mode What is the best way to deal with the -Debug flag between a production and development environment? Obviously its not desirable to go into the file and remove the flag every time the code goes to prod. I see you can start the stanalone server with -d to force debug. I think I remember about an environment variable to set debug also. Is the preferred method to take the hardcoded flag out and use one of these, or is there another way (such as a config option)? How are people dealing with this? 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/
Re: [Catalyst] running a function once on all requests
Eden Cardim wrote: > On 6/4/07, Steve Francia <[EMAIL PROTECTED]> wrote: >> Anyone know of any good reason to do it differently, or has anyone used >> other strategies in the past? > > That looks like auto-chaining, you might want to take a look at "auto" > actions. > > http://search.cpan.org/~jrockway/Catalyst-Manual-5.700701/lib/Catalyst/Manual/Intro.pod#Built-in_actions_in_controllers/autochaining > > http://dev.catalystframework.org/wiki/FlowChart > It does look like auto-chaining, so perhaps I should restate my original question. What I want to do is a bit more specific. I am using chaining a decent amount, often chaining across different controllers. The end result of what I want to do is pass into the template (TT) the top most level controller name IE the controller closest to root. This is accessed using $c->namespace, from within the controller. If I use auto-chaining like: sub auto : Private { my ( $self, $c ) = @_; $c->stash->{ controller } = $c->namespace; } in the root controller (Root.pm). It works until I chain across more than one controller. Instead of the first, it gives me last controller in the chain, which leads me to believe that this method is either called once for each controller or called only once, but from the last controller in the chain. Perhaps there is a different approach with autochaining I should try. ___ 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] running a function once on all requests
--- Steve Francia <[EMAIL PROTECTED]> wrote: > I have a routine I would like to run once for each > request. > > After reading through the docs, I think I have found > a good approach and > am wondering what others have done. > > I created a base controller which uses base > 'Catalyst::Controller' . > Inside the base controller I create a begin > function: > > sub begin : Private { > my ( $self, $c ) = @_; > > $c->stash->{ controller } = $c->namespace; > } > > In all my other controllers I use this base class. > > If I want to add a controller specific begin routine > to a controller I > place the following in that controller class: > > sub begin : Private { > my ( $self, $c ) = @_; > > $self->SUPER::begin($c); > # CONTROLLER SPECIFIC LOGIC HERE > } > > > Anyone know of any good reason to do it differently, > or has anyone used > other strategies in the past? > > Thanks, > Steve Francia I think begin actions where created for exactly this reason. The only thing I do differently is to use NEXT or C3 instead of SUPER. --john __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.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/
Re: [Catalyst] running a function once on all requests
On 6/4/07, Steve Francia <[EMAIL PROTECTED]> wrote: Anyone know of any good reason to do it differently, or has anyone used other strategies in the past? That looks like auto-chaining, you might want to take a look at "auto" actions. http://search.cpan.org/~jrockway/Catalyst-Manual-5.700701/lib/Catalyst/Manual/Intro.pod#Built-in_actions_in_controllers/autochaining http://dev.catalystframework.org/wiki/FlowChart -- Eden Cardim Instituto Baiano de Biotecnologia Núcleo de Biologia Computacional e Gestão de Informações Biotecnológicas Laboratório de Bioinformática ___ 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] running a function once on all requests
I have a routine I would like to run once for each request. After reading through the docs, I think I have found a good approach and am wondering what others have done. I created a base controller which uses base 'Catalyst::Controller' . Inside the base controller I create a begin function: sub begin : Private { my ( $self, $c ) = @_; $c->stash->{ controller } = $c->namespace; } In all my other controllers I use this base class. If I want to add a controller specific begin routine to a controller I place the following in that controller class: sub begin : Private { my ( $self, $c ) = @_; $self->SUPER::begin($c); # CONTROLLER SPECIFIC LOGIC HERE } Anyone know of any good reason to do it differently, or has anyone used other strategies in the past? Thanks, Steve Francia ___ 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::Plugin::Session, Facebook, and Custom Session ids
So I've started using the Session::State::URI plugin (with rewrite turned off... I don't need that aspect of it), but have quickly encountered a problem with using an externally created session key with Catalyst::Plugin::Session... it doesn't pass validate_session_id(). The session key I receive from Facebook and attempt to use the the session id is not alphanumeric... e.g. 1254342bc1f2af7558f5979d-728080233 I end up getting the following error: Tried to set invalid session ID '1254342bc1f2af7558f5979d-728080233' at /usr/share/perl5/Catalyst/Plugin/Authentication.pm line 103 Is there any way to disable the validation of session ids? Seems like it would be a somewhat useful option for those cases (like interfacing with Facebook), where the session ids are pre-created. - Jim Yuval Kogman wrote: The code below is essentially Catalyst::Plugin::Session::State::URI with param set to 'token'. On Wed, May 30, 2007 at 23:00:06 -0700, Jay Buffington wrote: I did something like this. With Session::State::Cookie the session id comes out of the cookie. I wanted web service calls using REST to be able to use that same session id, but pass it as a http parameter (called token) rather than in the cookie. With the below code catalyst will first look for the session in in a url param like this: http://myapp.com/foo?token=af3423e342dac987d8e0a0e If there is no token param the NEXT will cause it to fall back to Session::State::Cookie and look for the session id in the cookie. *** in MyApp.pm *** use Catalyst qw/ Session::State::Token Session::State::Cookie /; *** in Catalyst/Plugin/Session/State/Token.pm *** package Catalyst::Plugin::Session::State::Token; use base qw/Catalyst::Plugin::Session::State/; use strict; use warnings; use NEXT; our $VERSION = "0.01"; sub get_session_id { my $c = shift; my $session_id = $c->request->params->{token}; if ( $session_id ) { $c->log->debug(qq/Found sessionid "$session_id" in request parameter/) if $c->debug; return $session_id; } $c->NEXT::get_session_id(@_); } 1; On 5/30/07, Jim Spath <[EMAIL PROTECTED]> wrote: I'm currently using the following plugins for session management in my Catalyst app: Session Session::Store::Memcached Session::State::Cookie Session::DynamicExpiry Along with the following authentication plugins: Authentication Authentication::Store::DBIC Authentication::Credential::Password It all works great on my site... however, I was looking to integrate our app into Facebook, and to have users login to our service through Facebook. For every request, they will be passing an parameter called fb_sig_user, which I should be using as a session id on our side. I was wondering if there was a way that I could override the automatic creation of session ids with the Facebook id, while also continuing to use my current setup for onsite users? I've looked through the docs and searched a bit and am unclear on this. Thanks! Jim ___ 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] debug mode
I wrote a cheap little plugin for my app to override $c->debug to return the debug flag from $c->config->{debug}. As such: package MyApp::Plugin::DebugMode; sub debug { my $c = shift; return $c->config->{debug} || 0; } 1; Then I just add a "debug: 1" line to my DEV/QA/UAT configs and make it "debug: 0" for my PROD config. It's been working pretty well for me. Enjoy, Matt Pitts On Mon, 2007-06-04 at 15:51 +0100, mark wrote: > I thought a nice way would be to be able to specify it in the config > file; then your _local.yml file could add it for the dev environment. > Yet to produce a patch for that though it should be pretty straight > forwards. > > Mark > > > __ > From: John Goulah [mailto:[EMAIL PROTECTED] > Sent: 04 June 2007 15:32 > To: The elegant MVC web framework > Subject: [Catalyst] debug mode > > > > What is the best way to deal with the -Debug flag between a production > and development environment? Obviously its not desirable to go into > the file and remove the flag every time the code goes to prod. I see > you can start the stanalone server with -d to force debug. I think I > remember about an environment variable to set debug also. Is the > preferred method to take the hardcoded flag out and use one of these, > or is there another way (such as a config option)? How are people > dealing with this? > > 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/ ___ 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] debug mode
On Mon, 4 Jun 2007, John Goulah wrote: What is the best way to deal with the -Debug flag between a production and development environment? Obviously its not desirable to go into the file and remove the flag every time the code goes to prod. I see you can start the stanalone server with -d to force debug. I think I remember about an environment variable to set debug also. Is the preferred method to take the hardcoded flag out and use one of these, or is there another way (such as a config option)? How are people dealing with this? I just specify all my plugins and flags in a config module and only include "-Debug" on non-prod machines, by looking at the hostname. -dave /*=== VegGuide.Orgwww.BookIRead.com Your guide to all that's veg. My book blog ===*/ ___ 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] debug mode
John Goulah wrote: > What is the best way to deal with the -Debug flag between a > production and development environment? Obviously its not desirable > to go into the file and remove the flag every time the code goes to > prod. I see you can start the stanalone server with -d to force > debug. I think I remember about an environment variable to set debug > also. Is the preferred method to take the hardcoded flag out and use > one of these, or is there another way (such as a config option)? How > are people dealing with this? If you start your development server from the command line, set environment variable CATALYST_DEBUG=1, e.g. CATALYST_DEBUG=1 script/myapp_server.pl -- Bernhard Graf ___ 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] debug mode
i use the following in sandbox httpd.conf's: BEGIN { $ENV{MYAPP_DEBUG} = 1; } use MyApp; and s/1/0/ for prod. > What is the best way to deal with the -Debug flag between a production and > development environment? Obviously its not desirable to go into the file > and remove the flag every time the code goes to prod. I see you can > start > the stanalone server with -d to force debug. I think I remember about an > environment variable to set debug also. Is the preferred method to take > the > hardcoded flag out and use one of these, or is there another way (such as > a > config option)? How are people dealing with this? > > 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/ > ___ 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] debug mode
I thought a nice way would be to be able to specify it in the config file; then your _local.yml file could add it for the dev environment. Yet to produce a patch for that though it should be pretty straight forwards. Mark _ From: John Goulah [mailto:[EMAIL PROTECTED] Sent: 04 June 2007 15:32 To: The elegant MVC web framework Subject: [Catalyst] debug mode What is the best way to deal with the -Debug flag between a production and development environment? Obviously its not desirable to go into the file and remove the flag every time the code goes to prod. I see you can start the stanalone server with -d to force debug. I think I remember about an environment variable to set debug also. Is the preferred method to take the hardcoded flag out and use one of these, or is there another way (such as a config option)? How are people dealing with this? 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/
[Catalyst] debug mode
What is the best way to deal with the -Debug flag between a production and development environment? Obviously its not desirable to go into the file and remove the flag every time the code goes to prod. I see you can start the stanalone server with -d to force debug. I think I remember about an environment variable to set debug also. Is the preferred method to take the hardcoded flag out and use one of these, or is there another way (such as a config option)? How are people dealing with this? 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/
Re: [Catalyst] deploying a Catalyst app
On 06/01/07 15:00, mla wrote: I've always used cvs/svn for the app. Tagged it for staging/prod and pulled the changes to the appropriate servers. svn++ -- Peter Karman . http://peknet.com/ . [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] Re: Getting Complaint from C::P::Session::Store::FastMmap.pm
On Mon, 4 Jun 2007 Jay Buffington inquired: > Are the two versions for Cache::FastMmap in your old and new site_lib > directory different? Hmmm, that's a possible candidate. (swack! Sound of hand hitting forehead) old site_lib Cache::FastMmap: 1.09 new site_lib Cache::FastMmap: 1.14 I'll look deeper in that direction tonight after work. Big thanks. /dennis ___ 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] Plugin HOWTO?
--- Michele Beltrame <[EMAIL PROTECTED]> wrote: > Hello Cristina! > > > I would like to know if there's any HOWTO (or best > practice) available > > on writing Catalyst's plugins. > > Try this: > > http://search.cpan.org/~jrockway/Catalyst-Manual-5.700701/lib/Catalyst/Manual/ExtendingCatalyst.pod > > Michele. Hi, Cristina, perhaps you could share with us the what task it is you are trying to do? If you read the posted link you will see that there are several ways to extend or integrate catalyst with your project depending on your goal or needs. --john __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.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/
Re: [Catalyst] Plugin HOWTO?
Hello Cristina! > I would like to know if there's any HOWTO (or best practice) available > on writing Catalyst's plugins. Try this: http://search.cpan.org/~jrockway/Catalyst-Manual-5.700701/lib/Catalyst/Manual/ExtendingCatalyst.pod Michele. -- Michele Beltrame http://www.varlogarthas.net/ ICQ 76660101 - MSN [EMAIL PROTECTED] Privacy: http://www.italpro.net/em.html ___ 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] Plugin HOWTO?
Good morning. I would like to know if there's any HOWTO (or best practice) available on writing Catalyst's plugins. Thanks, Cristina ___ 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] Getting Complaint from C::P::Session::Store::FastMmap.pm
Are the two versions for Cache::FastMmap in your old and new site_lib directory different? Jay On 6/2/07, Dennis Daupert <[EMAIL PROTECTED]> wrote: My app has been running; I decided it's time to package it up. I hadn't been keeping track of all my included modules in Makefile.PL, so I renamed 'site_perl' directory and recreated, so I could do a new install of Catalyst and company. I had Catalyst 5.7006, now 5.7007. C::P::S::S::FastMmap is still at 0.02. App starts up OK, and I can get to a few pages that avoid the login stuff, but everything else gets this error: "Can't use string ("1180812469") as a SCALAR ref while "strict refs" in use at /usr/lib/perl5/site_perl/5.8.8/Catalyst/Plugin/Session/Store/FastMmap.pm line 62." Comes from this routine: 60 sub get_session_data { 61 my ( $c, $sid ) = @_; 62 ${ $c->_session_fastmmap_storage->get($sid) || return }; 63 } Help? /dennis ___ 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/