Question

I have a fully web site in perl under cgi-bin, but now, at client side, i'll move to MVC all my client stuff.. i decided that would be AJAX heavy with smooth transitions between sections instead of full refreshes.

At this point, there is no problem at all.

First problem, comes that i want to make an fully perl restapi to clarify things and take the fully advantaged of use backbonejs for example.

So, at this point i have somenting like this:

www.foo.com/cgi-bin/home.pl
www.foo.com/cgi-bin/wines.pl

...

After reading a lot, i'm thinking to use Dancer, since seems quite simple and fast.

My main question after all these lines is simple..

Where should i create my project? "Dancer -a App" is it supposed to be created inside cgi-bin?

I'm developing under windows machine, but my host is ubuntu, so, could you guys tell me what is the most common directory?

After hours trying to work with that, nothing.. still unable..

I can run my app as standalone like "perl bin/MyApp.pl" but in deploying nothing..

my httpd.conf

<virtualhost *:80>
   ServerName localhost
    DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs/MyApp/public/"
    ServerAdmin admin@localhost

    <directory "C:/Program Files/Apache Group/Apache2/htdocs/MyApp/public/">
       AllowOverride None
       Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
       Order allow,deny
       Allow from all
       AddHandler cgi-script .cgi
    </Directory>

ScriptAlias / C:/Program Files/Apache Group/Apache2/htdocs/MyApp/public/dispatch.cgi/

what am i doing wrong?

Was it helpful?

Solution 2

I usually stick my Dancer project in ~/src/My-Dancer-Proj

Then, rather than using cgi, I use fastcgi. My httpd.conf looks like this...

<VirtualHost *:80>
  ServerName myserver.com
  DocumentRoot /home/my_user/src/My-Dancer-Proj/public
  <Directory "/home/my_user/src/My-Dancer-Proj/public">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
    AddHandler fcgid-script .fcgi
  </Directory>

  RewriteEngine On
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /dispatch.fcgi$1 [QSA,L]
</VirtualHost>

OTHER TIPS

There are different question. Let me see if I can help.

Where should i create my project? "Dancer -a App" is it supposed to be created inside cgi-bin?

No. Please read http://metacpan.org/pod/Dancer::Deployment how to setup your Dancer environment.

I'm developing under windows machine, but my host is ubuntu, so, could you guys tell me what is the most common directory?

I do the same, but there is no 'common'. Configure your Dancer app on your local system and avoid absolute paths. Then take the complete app directory to your ubuntu system and run it there.

For developing (on windows) I usually use perl bin/app.pl to develop the application. On the *nix system I use starman (sometimes behind nginx), but that is all covered in Deployment

HTH

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top