Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Use a Perl script to automate Flash content' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use a Perl script to automate Flash content
Authored by: Fred E. Webber on Apr 16, '05 10:08:12PM
I'm not certain about OpenLaszlo, though it sounds intriguing. But I'm a hacker at heart and prefer simple tasks to be handled simply. The PERL code presented in this article was a bit buggy and verbose ; so here's a cleaner example:

#! /usr/bin/Perl
$| = 1; # flush buffer

$webServerRoot = "/Library/WebServer/Documents/";

use File::Find;
use CGI qw(:standard);

print STDOUT header(); # from CGI

find(\&findFilter, $webServerRoot);

sub findFilter {
  my ($theFileName) = $_;
  my ($pathAndFile) = $File::Find::name;
  my ($relPath) = $pathAndFile;
  $relPath =~ s/$webServerRoot//i;

  return unless ($theFileName =~ /\.html?$/i);
  
  print STDOUT "<a href=\"$relPath\">$theFileName</a><br>\n";
# or whatever you need it to look like
}

This could be much simpler: basically a one-liner grep, but I already had this handy. Also, if you call the cgi directly from Flash via:

"loadVariablesNum ("dirgrep.cgi", 0);"
you don't need to go through the intermediary step of writing to a file (which may cause file lock issues.)



[ Reply to This | # ]
Use a Perl script to automate Flash content
Authored by: bloodycelt on Apr 18, '05 05:47:37AM

I am sorry to say that while I found the criticism of the buggy and verbose script, your script does not work at all.

1. LoadVariablesNum refuses to load scripts for me, it gives errors and only loads variables from text files. I use Flash MX 2004. Thats what it does.

2. Even so the output must be formatted as var=value&var2=value2 format.

3. My goal was to have separate variables for each directory since I was using the directory structure to organize my files. Your script would just list all of them in one huge listing.

I am working on cleaning the script up and ill repost it hopefully in a more readable manner.



[ Reply to This | # ]