The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

SWF::NeedsRecompile - Tests if any SWF or FLA file dependencies have changed

LICENSE

Copyright Clotho Advanced Media Inc.

This software is released by Clotho Advanced Media, Inc. under the same terms as Perl itself. That means that it is dual-licensed under the Artistic license and the GPL, and that you can redistribute it and/or modify it under the terms of either or both of those licenses. See the "LICENSE" file, or visit http://www.clotho.com/code/Perl

The definitive source of Clotho Advanced Media software is http://www.clotho.com/code/

All of our software is also available under commercial license. If the Artisic license or the GPL does not meet the needs of your project, please contact us at info@clotho.com or visit the above URL.

We release open source software to help the world. We hope that you will enjoy this software, and we also hope and that you will hire us. As authors of this software, we are best able to help you integrate it into your project and to assist you with any problems.

SYNOPSIS

use SWF::NeedsRecompile qw(check_files);
foreach my $file (check_files(<*.swf>)) {
   print "SWF needs recompilation: $file\n";
}

DESCRIPTION

This module parses .fla and .as files and determines dependencies recursively, via import and #include statements. It then compares the timestamps of all of the dependencies against the timestamp of the .swf file. If any dependency is newer than the .swf, that file needs to be recompiled.

LIMITATIONS

This module only works in its entirety on Mac OS X, and for Flash MX 2004. Help wanted: extend it to Windows (add appropriate search paths at the top of the .pm file) and extend it to the Flash 8 author when that is available.

This module only reports whether or not the .swf is up to date. It would be useful to know whether it is out of date because of the .fla file or any .as files. In the latter case, the open source MTASC (http://www.mtasc.org/) application could perform the recompilation.

This module likely only works with ASCII filenames. The heuristic used to parse the binary .fla files discards the upper Unicode byte of any filenames.

If there are import statements with wildcards in any .as files, then all files in the specified directory are considered dependencies, even if only a subset are actually used.

Direct access to class methods are not detected. So, if you Actionscript does something like com.example.Foo.doSomething() then com/example/Foo.as is not detected as a dependency. The workaround is to add an import; in this example it would be import com.example.Foo;

FUNCTIONS

check_files FILE, FILE, ...

Examine a list of .swf and/or .fla files and return the filenames of the ones that need to be recompiled.

Performance note: Information is cached across files, so it's faster to call this function once with a bunch of files than a bunch of times with one file each invocation.

as_classpath

Returns a list of Classpath directories specified globally in Flash.

flash_prefs_path

Returns the filename of the Flash preferences XML file.

flash_config_path

Returns the path where Flash stores all of its class prototypes.

SEE ALSO

Module::Build::Flash uses this module.

AUTHOR

Clotho Advanced Media Inc., cpan@clotho.com

Primary developer: Chris Dolan