Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Do you hide .pl extension on web pages?

by choroba (Cardinal)
on Jan 23, 2013 at 16:19 UTC ( [id://1014947]=note: print w/replies, xml ) Need Help??


in reply to Do you hide .pl extension on web pages?

Use Dancer and your url can be something like
http://www.mysite.com/question/q4
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: Do you hide .pl extension on web pages?
by Tommy (Chaplain) on Jan 23, 2013 at 18:07 UTC

    Right. I use Perl Catalyst and this isn't an issue. Using an MVC for your web application is definitely the way to go. I was a die-hard CGI guy for several years, but after having used a real MVC web application framework, I wouldn't do it any other way. The scalability is mind-blowing.

    Tommy
    A mistake can be valuable or costly, depending on how faithfully you pursue correction
      Die-hard CGI guy - yes, that's it. But, after suffering the indignity of having my example called "a really old school URL", I'm thinking it's time to join the 2010's.

      I've been reading about Dancer today. What's not clear to me is - it's a module you download from CPAN an install, but it sounds like a server, for example "listening" on a port. The intro slides on the Dancer website offer this seemingly oxymoronic explanation: "A Dancer script is a webserver."

      Script or webserver?

      Anyone?

      Thanks.




      Time flies like an arrow. Fruit flies like a banana.
        The trick is it is both. The application can run in a Plack web-server (Starman, Twiggy, Corona), but without one, it starts its own little webserver.
        لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
        Dancer is a framework for building web applications and, like most such frameworks these days, it includes its own mini-webserver to use for development, so that you don't need to have a "real" HTTP server running on your dev machine. When you're ready to deploy the app, it's up to you whether you want to have it run as a native PSGI application, as CGI, as FastCGI, or whatever other way you might come up with.

        Script or webserver?

        Application

        Dancer provides you with a bunch of fancy keywords, but its really just a fancy PSGI application at heart :) and can run on any PSGI server without modification (or CGI or mod_perl or whatever .... ) thanks to Plack

        Most any CGI program with proper scoping of variables ( CGI to mod_perl Porting. mod_perl Coding guidelines ) can be trivially converted into a PSGI application, and it can run on Dancer/Mojo... Plack, any PSGI server, and it can have as NICE or CRAZY of a url as you want (provided you abstracted your url/link writing stuff so its easy to customize)

        Try it out cgi-app / mojo / dancer / catalyst / titanium and you'll see they all generate a module and various scripts, for example

        $ dancer -a MyDancerApp
        + MyDancerApp
        + MyDancerApp\bin
        + MyDancerApp\bin\app.pl
        + MyDancerApp\config.yml
        + MyDancerApp\environments
        + MyDancerApp\environments\development.yml
        + MyDancerApp\environments\production.yml
        + MyDancerApp\views
        + MyDancerApp\views\index.tt
        + MyDancerApp\views\layouts
        + MyDancerApp\views\layouts\main.tt
        + MyDancerApp\MANIFEST.SKIP
        + MyDancerApp\lib
          MyDancerApp\lib
        + MyDancerApp\lib\MyDancerApp.pm
        + MyDancerApp\public
        + MyDancerApp\public\css
        + MyDancerApp\public\css\style.css
        + MyDancerApp\public\css\error.css
        + MyDancerApp\public\images
        + MyDancerApp\public\500.html
        + MyDancerApp\public\404.html
        + MyDancerApp\public\dispatch.fcgi
        + MyDancerApp\public\dispatch.cgi
        + MyDancerApp\public\javascripts
        + MyDancerApp\public\javascripts\jquery.js
        + MyDancerApp\t
        + MyDancerApp\t\002_index_route.t
        + MyDancerApp\t\001_base.t
        + MyDancerApp\Makefile.PL
        

        app.pl runs the built-in Dancer webserver unless it is loaded via Plack::Runner or other PSGI webserver, which is done via dispatch.cgi so you can run it from a cgi-bin :)

        See Dancer::Deployment - common ways to put your Dancer app into use

        Also, search around for plack/dancer slideshows/presentations, they give a nice overview

        Just to add to the pile, I used Dancer at my last employer, and while there's a learning curve, it also makes all kinds of things way easy. One of the cool things you can do is write an application, then have Dancer run your application locally (usually on port 3000) for you to fool around with. No fiddling around with Apache, just go!

        Alex / talexb / Toronto

        "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1014947]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-19 07:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found