PDA

View Full Version : Bringing in text file via Perl.


annexion
07-17-2003, 05:42 PM
I'm not usually one to ask someone to do work for me, but if someone could kindly show me how I'd go about using Perl to bring a text file into Flash I'd appreciate it. I'm using a free host for a small project, and the host doesn't allow Flash to import text files dynamically, but they do have Perl support. What would I need to simply have a Perl read a text file, and send the contents to an swf? I can manage the actionscript part of it, I'm just ignorant in Perl. Greatly appreciated.

freddycodes
07-17-2003, 05:51 PM
Stick this in your cgi-bin, and adjust the path to the text file.


#!/usr/bin/perl
open (myHandle, "sp.txt");
foreach $myLine (<myHandle>) {
print $myLine;
}
close(myHandle);
exit;


Then just use LoadVars() like laoding a regular text file but address the .cgi file instead.

macs
07-19-2003, 03:48 PM
This bit helped me as well!

annexion
07-20-2003, 01:46 AM
Freddy, sorry about the latency in thanking you. Greatly appreciated man, thanks a lot.

freddycodes
07-20-2003, 01:49 AM
No problem.