Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
https://gist.github.com/hesco/84f60c9c7eb5e4e6725262cd854dda1e

I am seeing this log entry: "[debug] Controller "Vote::Controller::User::Login::User::Login" does not exist". However, it would find everything it needs, instead at this path: Vote::Controller::User::Login.

[Sun Jan 7 17:42:43 2018] [debug] GET "/cgi-bin/index" [Sun Jan 7 17:42:43 2018] [debug] Routing to a callback [Sun Jan 7 17:42:43 2018] [debug] [CGI:index:23229] START /opt/local/ +vote/vagrant/cf_vote/scripts/index [Sun Jan 7 17:42:45 2018] [debug] 200 OK (1.266254s, 0.790/s)

That worked fine.

[Sun Jan 7 17:42:50 2018] [debug] GET "/cgi-bin/login" [Sun Jan 7 17:42:50 2018] [debug] Routing to application "Vote::Contr +oller::User::Login" [Sun Jan 7 17:42:50 2018] [debug] Controller "Vote::Controller::User: +:Login::User::Login" does not exist

Expecting to seek, instead:
Vote::Controller::User::Login

[Sun Jan 7 17:42:50 2018] [debug] Rendering template "user/login/logi +n_dispatch.html.ep" [Sun Jan 7 17:42:50 2018] [debug] Rendering template "auth/login_page +.html.ep" [Sun Jan 7 17:42:50 2018] [debug] Rendering template "auth/login.html +.ep" [Sun Jan 7 17:42:50 2018] [debug] Rendering template "auth/password_r +eminder.html.ep" [Sun Jan 7 17:42:50 2018] [debug] Rendering template "auth/password_r +eset.html.ep" [Sun Jan 7 17:42:50 2018] [debug] Rendering template "auth/get_a_logi +n.html.ep" [Sun Jan 7 17:42:50 2018] [debug] Rendering template "layouts/default +.html.ep" [Sun Jan 7 17:42:50 2018] [debug] Rendering template "layouts/header. +html.ep" [Sun Jan 7 17:42:50 2018] [debug] Rendering template "auth/logout.htm +l.ep" [Sun Jan 7 17:42:50 2018] [debug] Rendering template "layouts/footer. +html.ep" [Sun Jan 7 17:42:50 2018] [debug] 200 OK (0.084435s, 11.843/s)

It found the intended templates, but unsupported by a useful controller, I am getting white screen of death in the browser.

package Vote; use lib qw( lib local/lib/perl5 ); use Mojo::Base 'Mojolicious'; use CGI; use Moose; use MooseX::NonMoose; # <snip other dependencies, several Moose-enabled attributes> sub startup { my $self = shift; my $log_file = 'VoteApp.log'; # <snip> $self->plugin('CGI', { support_semicolon_in_query_string => 1, route => '/cgi-bin/index', script => '/opt/local/vote/vagrant/cf_vote/scripts/index', errlog => $log_file, }); # and several additional routes to legacy 2006 era cgi scripts $r->any(['GET','POST'] => '/cgi-bin/login')->to( controller => 'user-login', action => 'login_dispatch', ); $r->any(['GET','POST'] => '/cgi-bin/password-reminder')->to( controller => 'user-login', action => 'login_dispatch', ); $self->plugin('CGI', { support_semicolon_in_query_string => 1, route => '/cgi-bin/admin', script => '/opt/local/vote/vagrant/cf_vote/scripts/admin', errlog => $log_file, }); # <snip> }

My question being: what is it I am missing about routing, which is causing this bug?

2018-01-09 Athanasius added code tags to log entry and linkified link

if( $lal && $lol ) { $life++; }
if( $insurance->rationing() ) { $people->die(); }

In reply to Mojolicious Routing mangles controller path by hesco

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2024-04-19 22:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found