Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I asked this question at StackOverflow. But I thought I may get a quicker response here.
I have had a webapp using CGI implementation. It basically uses system() calls to launch other programs and the results will be rendered in html. Now, I am trying to implement it using Dancer. In order to run these external programs, I created a "scripts" directory in /MyApp, so it's like /MyApp/scripts. I put all my other scripts there, which will be called in a route handler.However, I can launch this app successfully as a standalone or using plackup/starman. But I can not deploy it with CGI. I did every step using dancer's doc regarding cgi deployment. I can successfully using cgi to launch dancer's example app. but when I tried to launch my own as above, I always got the error:get '/analysis' => sub { if (session('user') && session('logged_in')) { open FH, "<", "./scripts/test.out"; my $msg = <FH>; close FH; chdir ("./scripts"); system("call sth"); #call external programs to generate a "test.pn +g" my $err; copy ("test.png", "../public/images/test.png") || ($err = "cannot +copy"); #copy the "test.png" to public/images directory, so the html +tt can use it my $img = "test.png"; template 'analysis',{msg => $msg, img => $img, err => $err}; } else { return redirect '/' } };
app directory '/home/tester/MyApp/bin/..' isn't writable/executable and can't chmod it at /usr/local/share/perl/5.14.2/Dancer/Logger.pm line 16, referer:localhost
It seems a permission problem, but I don't know how to fix it. Is there a better way to launch an external program from route handler? where should I store these external programs, thus they can be executed by the dancer app when it was deployed as CGI. Could anyone help me? Thanks.Xiaokuan
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to deploy perl dancer app with cgi and calling external scripts?
by Corion (Patriarch) on Dec 30, 2013 at 08:14 UTC | |
|
Re: How to deploy perl dancer app with cgi and calling external scripts?
by Anonymous Monk on Dec 30, 2013 at 08:22 UTC |