#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    246

    Catalyst controllers don't work?


    Hi,

    I've ran the helper script
    Code:
    perl script/myapp_create.pl controller Library
    Ran fine. In the controller is the default 'index' sub
    Code:
    sub index :Path :Args(0) {
        my ( $self, $c ) = @_;  
    
        $c->response->body('Matched Members::Controller::Library in Library.');
    }
    Which I understood is the 'root path' sub for that controller if no arguments are passed?

    However, instead all I get is the Root.pm 'index' page displayed in the browser? why? in the test environment I get a 404 viewing localhost, but if I visit the actual live website I get the root index page?

    And the server debug output shows for the devel server..
    [debug] Path is "/"
    [debug] Arguments are "library"
    [debug] "GET" request for "library" from "127.0.0.1"
    [debug] Response Code: 404; Content-Type: text/html; charset=utf-8; Content-Leng
    th: 14
    [info] Request took 0.008375s (119.403/s)
    Why is it showing path as '/' and an argument of 'library' instead of a path of 'library' with no arguments?

    And why isn't the controller running? it exists for the path 'library' ?

    and in the devel server it isn't showing anything relating to actions for the Library.pm only the Root.pm controller?

    Though it does show the Library.pm as a controller of type instance, so why isn't it picking up the actions in the controller?

    Am I too stupid to use this damn framework?
    Last edited by 1DMF; October 17th, 2012 at 06:05 AM.
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2007
    Posts
    765
    Rep Power
    929
    Can you start the server with the --debug flag and post the output?
    sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    246
    grrr, dunno why, but I had a hunch that perhaps 'Library' is a keyword, stop word or something you can't use!

    My hunch was right, created a different controller called 'LibraryDocs' and it works fine.

    No wonder I couldn't work out why it was behaving the way it was, I thought I had at least grasped the basics for action/method calls via URL path!

    Catalyst is enough to drive a man to drink!
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    246
    nah , I'm going round in circles, back to getting a 404 for librarydocs path?

    I've ran the server with --debug, I don't get any output other than the normal
    [info] Members powered by Catalyst 5.90015
    [warn] Deprecated 'static' config key used, please use the key 'Plugin::Static::
    Simple' instead
    HTTP::Server::PSGI: Accepting connections at http://0:3000/
    [info] *** Request 1 (0.010/s) [940] [Wed Oct 17 12:44:32 2012] ***
    [debug] Path is "/"
    [debug] Arguments are "librarydocs"
    [debug] "GET" request for "librarydocs" from "127.0.0.1"
    [debug] Response Code: 404; Content-Type: text/html; charset=utf-8; Content-Leng
    th: 14
    [info] Request took 0.010746s (93.058/s)
    .------------------------------------------------------------+-----------.
    | Action | Time |
    +------------------------------------------------------------+-----------+
    | /auto | 0.000286s |
    | /default | 0.000119s |
    | /end | 0.000325s |
    '------------------------------------------------------------+-----------'
    I'm not sure catalyst works on IIS7 & ActiveState Perl?

    Edit -> I also seem unable to get the production server to process changed files?

    I've even stopped and started the website in IIS, If I visit a URL in my browser to the 'live' website, it's displaying text in a sub that doesn't exist?

    Where is it getting this from, why is it not reflecting changes I make to the code?

    I cannot get anything to run in catalyst via my browser, i've cleared my chace, restarted the webserver, it's showing stuff that doesn't exist and won't work for paths that do exist such as showing the root.pm 'index' sub with the welcome screen?

    instead of parsing the URL, it running a path/method I didin't call via the URL and the output doesn't even exist in that method?

    I really think it might be time to give up!
    Last edited by 1DMF; October 17th, 2012 at 07:05 AM.
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    246
    That's it I give up!

    I have the devel server running but the 'live' website path will not resolve!

    All I get now for any url path to a controller is the default 'root' index sub to the welcome screen.

    I do not understand why the real website won't resolve.

    The only difference between the URLs is the devel has a port number and the live site doesn't as I'm just running over standard http port 80.

    If any one knows why Catalyst won't resolve the paths, please let me know.

    Thanks,
    1DMF.
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!
  10. #6
  11. !~ /m$/
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    May 2004
    Location
    Reno, NV
    Posts
    4,252
    Rep Power
    1810
    Is this the same machine that already has IIS listening on port 80?
  12. #7
  13. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    246
    Yes, it hosts @ 50 websites as well as this one

    I've yet to assign another IP and bind SSL to it on it's own port number, but that shouldn't matter should it, Catalyst works via virtual host doesn't it?

    It certainly resolves the virtual header hence getting the app welcome screen, but are you suggesting IIS is stripping / witholding / corrupting the URL path in some way?
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!
  14. #8
  15. !~ /m$/
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    May 2004
    Location
    Reno, NV
    Posts
    4,252
    Rep Power
    1810
    All these application servers that I'm aware of can act as their own web server, which is typically used for development. If you are going to run them under some other web server, that web server needs to know to forward the requests to the app server; so you'll have to do a bit more configuration.

    Deploying Catalyst Apps

    CPAN

    discussion
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2007
    Posts
    765
    Rep Power
    929
    One thing that comes to mind (sorry I can't put my finger on any specifics, this was a while back). I recall reading something that Catalyst expects to be working from the root of the URL. E.g. www.example.com/some-controller rather than www.example.com/some-app/some-controller. When you say this IIS server is handling other sites, does that mean Catalyst may be seeing URLs with some unrelated directory prefix?

    Though if the Catalyst app works as expected connecting with the perl HTTP server, a configuration issue with IIS seems most likely. I'm becoming suspicious that the Catalyst FCGI server isn't running the code you think it is. Could IIS be connecting to an old daemonized copy of the app or caching or some such--I don't have any knowledge of IIS. Maybe it would be helpful to bring up the issue in the IIS forum or see if there's a Catalyst mailing list specific to running under Windows.
    sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);
  18. #10
  19. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    246
    Kieth -> I've done all this!

    http://wiki.catalystframework.org/wi...t/iis7_fastcgi

    Apart from the fact the above link is awfull with all the images missing, the application is running, I've mapped FastCGI to the application, I get the welcome screen, it's just not functioning correctly!

    Omega -> there is no other copy, there is one application, and to be sure I added another IP to the server NIC, bound the host to listen on port 4000 for the new IP address only, and it still won't resolve the path->controller->action.

    So giving it it's own unqiue IP address and specifying a port that the IIS7 installation guide suggests and it being the only site attached to that IP / Port, it still won't resolve correctly.

    So I can say 100% there is something wrong with Catalyst / IIS7 / FastCGI , where the issues is I have no idea, all I know is for me Catalyst doesn't work.

    Edit-> I have now gone through every website in IIS and reconfigured the bindings as many were set to listen on 'All Unasigned' - I have now correctly bound each website to the relevent IP address, so the ONLY website bound to the Catalyst IP / Port is the Catalyst application.

    Same result, the app doesn't resolve the Path->Controller->Action.
    Last edited by 1DMF; October 19th, 2012 at 04:59 AM.
    Free MP3 Dance Music Downloads

    To err is human; To really balls things up you need Microsoft!
  20. #11
  21. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    1
    Rep Power
    0
    I was running into the same problem. This setting in the Catalyst config did the trick:

    'use_request_uri_for_path' config variable needs to be set to true (1).

    I can't post the URL because I'm a new user, but the see the Catalyst-Runtime document, configuration section, in CPAN for a good description
  22. #12
  23. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    246
    Thanks msabochi,

    You are correct, I actually got this answer from the Catalyst community yesterday and updated my other thread with the answer.

    Appreciate you chiming in on this one.

    For those who are unsure where this is , it's in the main application module (under the 'lib' directory).

    you need to add to
    Code:
     __PACKAGE__->config {
    
    use_request_uri_for_path => 1
    
    }
    for further information here is the cpan documentation...

    https://metacpan.org/module/Catalyst#CONFIGURATION
    Free MP3 Dance Music Downloads

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

IMN logo majestic logo threadwatch logo seochat tools logo