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

    Join Date
    Dec 2009
    Posts
    335
    Rep Power
    246

    Dancer - what am I missing?


    OK, I feel like I'm so thick I don't even know how to turn a computer on.

    I've looked at RoR, it makes no sense to me! - removed it.

    I've installed Dancer, I've created a script with the first demo example
    Code:
    #!/usr/bin/perl
    
    use Dancer; 
    
    get '/' => sub {return 'Hello World!';}; 
    
    start;
    I've uploaded to my CGI-BIN and I've pointed my browser to it, it is supose to output 'Hello World' , all I get is the browser eggtime and do nothing!

    What am I missing, why won't the script run?

    What's the point of Dancer?

    Can someone point me to some literature that explains in single sylable english what a framework is, the point of it , how it works, and why should I bother when I can roll a perl app with my eyes closed, yet can't get the most basic starter script in a framework to say hello?

    Thanks,
    1DMF.
    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
    Hopefully a someone with Dancer experience will chime in. The following is based on my experience with Catalyst which looks similar after skimming the docs.

    I suspect that you're trying to treat Dancer the same a CGI.pm--i.e. stick one script per URL in a public directory and telling your web server to execute it and return the result.

    Instead these modules behave more like web servers themselves--you write a script with subroutines to handle each URL and run it as a daemon which will respond to requests. Usually these frameworks have a utility to create a collection of directories and scripts to get you started (in this case, dancer).

    You're probably looking at some significant relearning before you things click and you make headway. Most of these frameworks have a big idea at the center and the pieces don't fall into place until you understand the architecture. (Not saying they will, I'm still confused enough on how Catalyst's URL construction works I plan on trying Yesod for my next project)

    Dancer::Introduction
    Dancer::Deployment
    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
    Well I decided to drop Dancer and go with Catalyst.

    I read somewhere that Catalyst is the leading industry framework for Perl, and when I checked it out there is a seriously comprehensive tutorial for beginners that even includes a VM image with full testing / 'work with the tutorial' environment.

    Within a couple of hours I had my Debian VM running, I downloaded Putty and had an SSH terminal services login, I had the first turtorial example 'Hello' web app running and my browser interacting with the 'Hello' application!

    So far so good

    Having gone through that process the penny started to drop as to how it worked, and as you say , my mindset was still old school perl, interpreted scripts running on an adhoc basis.

    Now I realise that the main app runs all the time listening for HTTP requests such as GET/POST/DELETE etc.. and then they are some how routed to perform the required action.

    I know I'm a long way from getting a real app working or even starting to understand the framework, but I've got far further with Catalyst than I did with RoR or Dancer!

    I will still have to convert that to how I get it to work on IIS7 via Fast-CGI, whether it runs as a service, how you have multiple apps running (I assume they listen on different port numbers, rather than all on 3000), I need to understand how SSL works if not over 443, and how to fit it all together for MS SQL!

    A lot to learn I know, but at least I have a working environment to play with Catalyst, and work through the tutorial and example apps to hopefully learn the framework.

    Then I can work out how to configure the IIS7 server to run a Catalyst application.

    Do you have any pointers for running on IIS7?

    Is this an IIS7 forum question, even though it's about running Perl apps?

    You advice is appreciated.

    1DMF.
    Free MP3 Dance Music Downloads

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

    Join Date
    May 2007
    Posts
    765
    Rep Power
    929
    Catalyst has some good docs on their site: Deployment - Catalyst Wiki. The IIS forum or a Catalyst-specific forum would probably be more helpful if you have further questions about IIS.

    I'm happy to help if I can, but I reiterate that my experience with Catalyst was with a bizarre setup (Nginx-MongoDB-Catalyst) and the projects ended before I managed to wrap my head around uri_for()'s quirks.
    sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);

IMN logo majestic logo threadwatch logo seochat tools logo