title: Perl catalyst controller redirect not working
body: <p>I have looked over this code and I can not understand the weirdness it exhibits. For a lack of understanding all I know</p>
  
  <pre><code>$c-&gt;res-&gt;redirect('qbo/home');
  </code></pre>
  
  <p>is being ignored, in favor of the redirect in the following if <strong>else</strong> condition. In other words, I always end up at the OAuthentication website. </p>
  
  <p>If I block comment out the else condition I end up where I want to go <strong>qbo/home</strong> </p>
  
  <pre><code>sub index :Path :Args(0) {
      my ($self, $c) = @_;
  
      # Check to see if we have QBO::OAuth object in our user's session
      # Create new object in session if we don't already have one
      if(!($c-&gt;session-&gt;{qbo})) {
              $c-&gt;log-&gt;info('Creating QBO::OAuth, save in user session');
              $c-&gt;session-&gt;{qbo} = QBO::OAuth-&gt;new(
                      consumer_key =&gt; 'qyprddKpLkOclitN3cJCJno1fV5NzcT',
                      consumer_secret =&gt; 'ahwpSghVOzA142qOepNHoujyuHQFDbEzeGbZjEs3sPIc',
              );
      }
  
      # Now we set our object variable to the session old or new
      my $qbo = $c-&gt;session-&gt;{qbo};
      ######### GOTO 'qbo/home' ##########
      $c-&gt;res-&gt;redirect('qbo/home');
      ####################################
      if($c-&gt;req-&gt;params-&gt;{oauth_token}) {
              $c-&gt;log-&gt;info('Now Redirect to access_endpoint');
              # Get realmId and save it to our QBO::OAuth object in user session
              $qbo-&gt;realmId($c-&gt;req-&gt;params-&gt;{realmId});
              # Call QBO::OAuth-&gt;request_access_token
              my $r = $qbo-&gt;request_access_token($c-&gt;req-&gt;params-&gt;{oauth_verifier});
              $c-&gt;res-&gt;redirect('qbo/home');
      } else {
              my $callback = 'http://www.example.com/qbo';
              # Request a token
              my $r = $qbo-&gt;request_token($callback);
              if($qbo-&gt;has_token) {
                      #Continue on down, Redirect to auth_user_endpoint
                      $c-&gt;res-&gt;redirect($qbo-&gt;auth_user_endpoint . '?oauth_token=' . $qbo-&gt;token);
              }
      }
  }
  </code></pre>
  
  <p>Seems I am missing some basic fundamental about how this works. Any clues appreciated</p>