Alien-Base
view release on metacpan or search on metacpan
lib/Alien/Base.pm view on Meta::CPAN
return $config->config(@_);
}
# helper method to split flags based on the OS
sub split_flags {
my ($class, $line) = @_;
if( $^O eq 'MSWin32' ) {
$class->split_flags_windows($line);
} else {
# $os eq 'Unix'
$class->split_flags_unix($line);
}
}
sub split_flags_unix {
my ($class, $line) = @_;
shellwords($line);
}
sub split_flags_windows {
# NOTE a better approach would be to write a function that understands cmd.exe metacharacters.
my ($class, $line) = @_;
# Double the backslashes so that when they are unescaped by shellwords(),
# they become a single backslash. This should be fine on Windows since
t/alien_base.t view on Meta::CPAN
);
is( -f File::Spec->catfile(Alien::libfoo2->bin_dir,'foo-config'), T(), 'has a foo-config');
is( Alien::libfoo2->runtime_prop->{arbitrary}, 'two', 'runtime_prop' );
};
subtest 'build flags' => sub {
my %unix_flags = (
q{ -L/a/b/c -lz -L/a/b/c } => [ "-L/a/b/c", "-lz", "-L/a/b/c" ],
);
my %win_flags = (
q{ -L/a/b/c -lz -L/a/b/c } => [ "-L/a/b/c", "-lz", "-L/a/b/c" ],
q{ -LC:/a/b/c -lz -L"C:/a/b c/d" } => [ "-LC:/a/b/c", "-lz", "-LC:/a/b c/d" ],
q{ -LC:\a\b\c -lz } => [ q{-LC:\a\b\c}, "-lz" ],
);
subtest 'unix' => sub {
while ( my ($flag, $split) = each %unix_flags ) {
is( [ Alien::Base->split_flags_unix( $flag ) ], $split );
}
};
subtest 'windows' => sub {
while ( my ($flag, $split) = each %win_flags ) {
is( [ Alien::Base->split_flags_windows( $flag ) ], $split );
}
};
};
( run in 0.866 second using v1.01-cache-2.11-cpan-df04353d9ac )