[Catalyst] Getting strange warning each time a request is made to myApp

kakimoto at tpg.com.au kakimoto at tpg.com.au
Fri Mar 13 16:12:56 GMT 2009


Hi, everyone,


 I  went into my MyApp::Controller::Login->index method and made some
changes.
I noticed that upon successful login of the current user, I will do a
redirect to the base path '/' (ie. www.insurance-example.com:3000/). So
in this case, i specified something like:
  "$c->response->redirect( $c->uri_for('/') );"


 This causes the warning to come up BUT  when I swap the '/' with a
controller that exists, the warning goes away. So in this case, i
specified something like:
  "$c->response->redirect( $c->uri_for('/subscriptions/update') );"


 Here is how my method looks like:


--------------- MyApp::Controller::Login->index  [ start ]
-------------------
sub index : Private {
    my ($self, $c) = @_;
    $c->log->debug( " in login .pm " );

    # Get the username and password from form
    my $username = $c->request->params->{username} || '';
    my $password = $c->request->params->{password} || '';

    # If the username and password values were found in form
    if ($username && $password) {
        # Attempt to log the user in

        if ($c->login($username, $password))
        {
            # If successful, then let them use the application
            #$c->response->redirect( $c->uri_for('/') );   ## GOT THE
WARNING WITH THIS UNCOMMENTED
    $c->log->debug( " Login is ok .... Redirecting now..." );
            $c->response->redirect( $c->uri_for('/subscriptions/create')
); ## GOT NO WARNING WITH THIS ACTIVE AND THE LINE ABOVE COMMENTED ('/')
            return;
        }   
        else
        {   
            # Set an error message
            $c->stash->{error_msg} = "Bad username or password.";
        }
    }   
            
    # If either of above don't work out, send to the login page
    $c->stash->{template} = 'login.tt2';
    
    return 1;
}   
    
--------------- MyApp::Controller::Login->index  [end ] -------------------


My question is, what's catalyst's problem? If i specified '/', then
shouldn't MyApp::Controller::Root->default pick it up and serve what
ever page is default?


K. akimoto





Quoting kakimoto at tpg.com.au:

> 
> Hi, everyone,
> 
>    I realised that my app's terminal console has been spitting out a
> warning as per below each time I make a request to the app. This is
> be
> it to '/' or to a valid controller like 'subscriptions/create',
> 'subscriptions/update',
> 'subscriptions/delete', and so forth.
> 
> 
> ----- extract START -------
> 
> [warn] Used regexp fallback for $c->model('myApp::View::HTML'),
> which
> found 'myApp::View::HTML=HASH(0x8ef7b50)'. Relying on regexp
> fallback
> behavior for component resolution is unreliable and unsafe. You
> probably
> meant $c->model('myApp::View::HTML=HASH(0x8ef7b50)') instead of
> $c->model{'myApp::View::HTML'}, but if you really wanted to search,
> pass
> in a regexp as the argument like so: $c->model(qr/myApp::View::HTML/)
> at
> /usr/local/lib/perl5/site_perl/5.8.9/Catalyst/Action/RenderView.pm
> line 56
> [debug] Rendering template "index.tt2"
> [debug] Applying HTML page layout wrappers to index.tt2
> 
> ----- extract END -------
> 
> Here are my loaded path actions:
> 
> 
> ----- extract START -------
> 
> [debug] Loaded Path actions:
>
.-------------------------------------+--------------------------------------.
> | Path                                | Private                      
>  
>      |
>
+-------------------------------------+--------------------------------------+
> | /                                   | /default                     
>  
>      |
> | /addresses                          | /addresses/index             
>  
>      |
> 
>     ...
> 
>
'-------------------------------------+--------------------------------------'
> 
> 
> ----- extract END -------
> 
> 
> I went into myApp::Controller::Root->end.
> 
> It now reads,  "sub end : ActionClass('RenderView') {}".
> 
> If I removed the whole line and restarted the app and tried to
> access
> any controller, well, nothing will get shown (rendered) on the web
> browser AND the warning dissappears. 
> 
> Just what am I doing wrong with the call to RenderView?
> 
> 
> Thanks!
> 
> 
> K. akimoto
> 
> 
> 
> 
> 
> _______________________________________________
> List: Catalyst at 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/
> 
> 
> 






More information about the Catalyst mailing list