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.
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 '/' } };
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:

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


In reply to How to deploy perl dancer app with cgi and calling external scripts? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.