Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 1st, 2012, 05:48 AM
1DMF's Avatar
1DMF 1DMF is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2009
Posts: 320 1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 3 Days 16 h 57 m 54 sec
Reputation Power: 227
Catalyst Routing - Clarification :confused:

Hi,

I've got my IIS7 Catalyst envioronment up and running and before I charge ahead with development, I was hoping for some clarification on a few things.

$c->go / $c->forward / $c->detach / $c->visit

I understand that forward / visit are linked, is it correct that forward only runs the method/action called and then returns back to the previous segment it was called from?

So auto/begin/end are not executed in the controller where the method is being called?

and so detach calls just the controller method and doesn't return or run auto/begin/end

and go will not return but will execute the auto/begin/end.

I've read this in the manual
Quote:
Keep in mind that the end method used is that of the caller action. So a $c->detach inside a forwarded action would run the end method from the original action requested.


So it seems if you forward and then that call uses detach, the end in the detach command isn't executed but the one in the forward is?

I'm confused.

I thought detach stops all returning calls and runs the action/method without going back, so how come the end in the calling forward is executed?

How do I call a method in a controller from either another controller or a model, which does not return back and finish any other chained calls, but does execute auto/begin/end in the newly called controller?

is it $c->go ?

Basically I have a controller 'Login' with a Private method and also an 'end' method.

Code:
sub locked :Private {   
    $c->stash->{message} = 'Sorry, system is currently undergoing maintenance, please try again later.';  
}

sub end :Private {
    
    $c->stash->{css} = 'login';         
    $c->stash(template => 'login.tp'); 
    
}


The first thing my app does before anything is authenticate the user. Part of that process is to check if the system flag for maintenace is set, if so, I don't care where in the chain of calls the application might be, I want it to stop, not return to anywhere, run the 'locked' method in the Login controller, including the 'end' method in the Login controller.

is that detach, go, visit, forward or something else?

Clarification is appreciated.
__________________
Free MP3 Dance Music Downloads

To err is human; To really balls things up you need Microsoft!

Reply With Quote
  #2  
Old November 1st, 2012, 12:31 PM
1DMF's Avatar
1DMF 1DMF is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2009
Posts: 320 1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level)1DMF User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 3 Days 16 h 57 m 54 sec
Reputation Power: 227
It's OK, I've got it all working now!

It turns out that begin / auto methods are bad and shouldn't be used, well auto in 'Root' is OK , but that's it!

Although their discussion is littered all over the Catalyst tutorial and CPAN docs, apparently it is bad and the 'Chained' attribute should now be used instead.

Also there are other mechanism for ensuring something is ran such as
Code:
before 'index' => sub {
    
    my ( $self, $c ) = @_;    

    do_what_ever
}


another thing to note is the 'Catalyst::Session::Plugin' CPAN docs have wrong information in them ....
Code:
 # To get sessions to "just work", all you need to do is use these plugins:

    use Catalyst qw/
      Session
      Session::Store::FastMmap
      Session::State::Cookie
      /;


FastMmap should *not* be used and is broken apparently


Instead it has been recommended that the following should be used instead.
Code:
    Session  
    Session::Store::File
    Session::State::Cookie


Hope it helps others

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Catalyst Routing - Clarification :confused:

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap