Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Mac::AppleScript::Glue in CGI script

by tachyon (Chancellor)
on Nov 13, 2004 at 05:21 UTC ( #407591=note: print w/replies, xml ) Need Help??

in reply to Mac::AppleScript::Glue in CGI script

See the CGI Help Guide. Amongst your issues is not printing a valid header (500 Internal Server Error). However if you did have a valid header and it runs on the command line the problem is almost certainly permissions as a CGI runs as the webserver user (nobody or apache typcially) not user you. Add this to see what the problem is:

BEGIN { $|=1; print "Content-type: text/html\n\n"; use CGI::Carp('fatalsToBrowser'); }



Replies are listed 'Best First'.
Re^2: Mac::AppleScript::Glue in CGI script
by Cody Pendant (Prior) on Nov 13, 2004 at 08:44 UTC
    I'm sorry not to have pointed out, I didn't just take the script above and try to run it as a CGI.

    I printed a valid header and used CGI::Carp and that didn't help. It still died silently at the line noted.

    Here's a script which works in the command-line and not in the browser:

    #!/usr/bin/perl use CGI::Carp qw(fatalsToBrowser); print "Content-type:text/plain\n\n"; require Mac::AppleScript::Glue; print "started\n"; my $BB = new Mac::AppleScript::Glue::Application('BBEdit') || die "$!"; print "success creating Applescript Glue App object\n"; my $results = $BB->check_syntax(file => 'path:to:file') || die "$!"; print "success checking syntax\n";

    It gets as far as the first success message, and then, if the file exists, just stops.

    If I try it on a file which doesn't exist, then yes, I get a failure from AppleScript and CGI::Carp does its thing. But if there is a file at that location, then it just stops.

    What can I investigate in terms of permissions?

    =~y~b-v~a-z~s; print
      Take a dummy file, chmod it to 777, then point your script at it. 777 is world-writable so if it works you know you have a permissions problem. If it doesn't work then it's probably something else. Either way, delete the file after you run your tests.

      In addition to the chmod 777 test file check you should switch debugging on. The syntax is a bit clunky but you do:

      $Mac::AppleScript::Glue::Debug{SCRIPT} = 1;

      Where SCRIPT can be SCRIPT,RESULT,PARSE,INIT,AUTOLOAD. This should get you more output if it is not a simple perms issue (which I still think it is). When you say stops there is stop and STOP! Is it hung or exited? Is it using 100% CPU or 0% cpu? Does it timeout eventually?



Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://407591]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2018-03-19 00:23 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (231 votes). Check out past polls.