SWF-NeedsRecompile
view release on metacpan or search on metacpan
lib/SWF/NeedsRecompile.pm view on Meta::CPAN
if (-f $fla && (my $content = File::Slurp::read_file($fla, binmode => ':raw')))
{
# Limitation: the path must be purely ASCII or this doesn't work
my @matches = $content =~ m/V\0e\0c\0t\0o\0r\0:\0:\0P\0a\0c\0k\0a\0g\0e\0[ ]\0P\0a\0t\0h\0s\0....((?:[^\0]\0)*)/gxms;
my %seen;
for my $match (@matches)
{
# Hack: downgrade unicode to ascii
$match =~ s/\0//gxms;
next if q{} eq $match;
my @search_paths = split m/;/xms, $match;
require File::Spec;
for my $path (@search_paths)
{
if (!File::Spec->file_name_is_absolute($path))
{
my $root = [File::Spec->splitpath($fla)]->[1];
if ($root)
{
$path = File::Spec->rel2abs($path, $root);
}
lib/SWF/NeedsRecompile.pm view on Meta::CPAN
my @matches = ${$content_ref} =~ m/i\0?m\0?p\0?o\0?r\0?t\0?(?:\s\0?)+((?:[^\;\0\s]\0?)+);/gxms;
foreach my $imp (@matches)
{
next if ($seen_ref->{$imp}++); # speedup
# This is a hack. Strip real Unicode down to ASCII
$imp =~ s/\0//gxms;
_log(2, "import $imp from $checkfile");
my $found = 0;
foreach my $dir (@{$fla_path_ref}, as_classpath())
{
my $f = File::Spec->catdir(File::Spec->splitdir($dir), split m/[.]/xms, $imp);
if ($f =~ m/[*]\z/xms)
{
my @d = File::Spec->splitdir($f);
pop @d;
$f = File::Spec->catdir(@d);
if (-d $f)
{
my @as = grep { m/[.]as\z/xms } File::Slurp::read_dir($f);
for my $file (@as)
lib/SWF/NeedsRecompile.pm view on Meta::CPAN
}
push @deps, @as;
}
$found = 1;
}
else
{
$f .= '.as';
if (-f $f)
{
my @p = split m/[.]/xms, $imp;
$imported_file_ref->{$p[-1] . '.as'} = 1;
_log(2, " import $f from $checkfile");
push @deps, $f;
$found = 1;
last;
}
}
}
return [$imp] if (!$found);
}
lib/SWF/NeedsRecompile.pm view on Meta::CPAN
# This is a hack. Strip real Unicode down to ASCII
$imp =~ s/\0//gxms;
next if ($exceptions{$imp});
_log(2, "instance $imp from $checkfile");
next if ($imported_file_ref->{$imp . '.as'});
# Is this class implemented in this very file?
next if any { $_ eq $imp || m/[.]\Q$imp\E\z/xms } @classes;
my $found = 0;
foreach my $dir (@{$fla_path_ref}, as_classpath())
{
my $f = File::Spec->catdir(File::Spec->splitdir($dir), split m/[.]/xms, $imp);
$f .= '.as';
if (-f $f)
{
_log(2, " instance $f from $checkfile");
push @deps, $f;
$found = 1;
last;
}
}
return [$imp] if (!$found);
( run in 2.102 seconds using v1.01-cache-2.11-cpan-71847e10f99 )