Joel Martinez
2013-02-02 01:00:43 UTC
Hey All,
I'm having an issue where Mojolicious isn't parsing my request's URLs
correctly. The result of which is that none of my routes are getting
triggered correctly.
This is my current setup:
I have a file "my_redis.cgi" with the following:
use FindBin;
use lib "$FindBin::Bin/../lib";
# Start commands for application
require Mojolicious::Commands;
Mojolicious::Commands->start_app('MyRedis');
Then in lib/MyRedis.pm
package MyRedis;
use Mojo::Base 'Mojolicious';
# This method will run once at server start
sub startup {
my $self = shift;
# Router
my $r = $self->routes;
# Normal route to controller
$r->route('/')->to(
controller => 'Browser',
action => 'index'
);
$r->get('/myredis/script/my_redis.cgi/#host/:port/key')->to('RedisKey#getKeys');
}
The problem is that no matter what URL I request from my_redis.cgi, I
always get served the "index" page ('/' route). For example:
http://mydomain/myredis/script/my_redis.cgi/somehost/6379/key will return
the index page.
I've tried inspecting what Mojolicious is parsing as the url in a
"before_dispatch" hook in my "startup" function and it's empty. For
example:
$self->hook(before_dispatch => sub {
my $self = shift;
warn $self->req->url->path; #NOTHING!
});
If someone could tell me what I'm missing here, I'd GREATLY appreciate it.
Thank you in advance.
Joel
I'm having an issue where Mojolicious isn't parsing my request's URLs
correctly. The result of which is that none of my routes are getting
triggered correctly.
This is my current setup:
I have a file "my_redis.cgi" with the following:
use FindBin;
use lib "$FindBin::Bin/../lib";
# Start commands for application
require Mojolicious::Commands;
Mojolicious::Commands->start_app('MyRedis');
Then in lib/MyRedis.pm
package MyRedis;
use Mojo::Base 'Mojolicious';
# This method will run once at server start
sub startup {
my $self = shift;
# Router
my $r = $self->routes;
# Normal route to controller
$r->route('/')->to(
controller => 'Browser',
action => 'index'
);
$r->get('/myredis/script/my_redis.cgi/#host/:port/key')->to('RedisKey#getKeys');
}
The problem is that no matter what URL I request from my_redis.cgi, I
always get served the "index" page ('/' route). For example:
http://mydomain/myredis/script/my_redis.cgi/somehost/6379/key will return
the index page.
I've tried inspecting what Mojolicious is parsing as the url in a
"before_dispatch" hook in my "startup" function and it's empty. For
example:
$self->hook(before_dispatch => sub {
my $self = shift;
warn $self->req->url->path; #NOTHING!
});
If someone could tell me what I'm missing here, I'd GREATLY appreciate it.
Thank you in advance.
Joel
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.