August 17, 2018, 03:27:08 PM

Author Topic: About CGI...  (Read 4954 times)

0 Members and 1 Guest are viewing this topic.

Offline benthehutt

  • Global Moderator
  • Seasoned Poster
  • *****
  • Posts: 368
  • Country:
  • "Drugs? You'd better not be!" - my mom
    • Echelon9
About CGI...
« on: September 23, 2005, 05:30:00 PM »
So I'm new to the whole Perl thing and CGI in the first place, and I'm having problems when requesting info from a perl script.  This is what's up:

I've got a swf file (flash) and I want it to talk to a perl script on the server.  So then, I've got the flash end good I think--though I haven't gotten the other end to work so I can't be too sure.  Anyway, the swf has a function called loadVariableNum that will connect to a script on a server and take whatever the script returns.  So, I just did this:

_root.lastModified = loadVariablesNum("lastUpdate.pl", 0, "POST");

where _root.lastModified is just where I'm storing it in flash.

That I think should work.

The file "lastUpdate.pl" goes like this:

Code: Perl
  1. #!d:/perl/bin
  2.  
  3. print "Content-type: text/html\n\n" ;
  4.  
  5. @URL = (flastmod, "monitoring.html");
  6.  
  7. print exec(@URL);
  8.  
  9.  

Theoretically this should return the date and time the page was last modified, but even if I just run the script from explorer it just prints "0."  I even tryed using system (which I belive is the one I should use--cause exec doesn't return anything) and rearranged stuff like this:

Code: Perl
  1. #!d:/perl/bin
  2.  
  3. print "Content-type: text/html\n\n" ;
  4.  
  5. print system(flastmod "monitoring.html");
  6.  
  7.  

Nothing freaking works!  What's the deal with this?  I know I have permissions and everthing, cause I wrote this to see if the Perl script could work on the server:

Code: Perl
  1. #!d:\perl\bin
  2.  
  3.  
  4. print "Content-type: text/html\n\n";
  5. print "\n";
  6.  
  7. foreach $key (sort keys(%ENV)) \
  8.    { print "$key = $ENV($key) <br>";
  9.    }
  10.  

And it printsout all the environmental variables.  Does anyone know why the script would only print "0" ?
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.

Offline benthehutt

  • Global Moderator
  • Seasoned Poster
  • *****
  • Posts: 368
  • Country:
  • "Drugs? You'd better not be!" - my mom
    • Echelon9
Re:About CGI...
« Reply #1 on: October 05, 2005, 03:59:16 PM »
So, here's why I'm an idiot: the exec command (and system) can't excecute flastmod--that's just an SSI thing.  So then, instead of going though all that crap I just put a SSI at the bottom of the page like this:

<!--#flastmod file="theFile.html" -->

and that (as you know) just puts the date on the bottom of the page.

I also found out that flash can't put much HTML in it's text boxes.  It only supports about ten tags, like <head>, <html>, <b>, <i>, etc.  So don't try to put a SSI in a flash text box! (since none of you use flash, no one cares anyway...)

BTW, does anyone know of any open source flash compiler projects?  It seems like it should be possible, just incredibly difficult to do...
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.