1898184e3Ssthen#! perl -w 2898184e3Ssthen 3898184e3Ssthenuse strict; 4898184e3Ssthenuse Test::More; 5898184e3SsthenBEGIN { 6898184e3Ssthen if ($^O eq 'VMS') { 7898184e3Ssthen # So we can get the return value of system() 8898184e3Ssthen require vmsish; 9898184e3Ssthen import vmsish; 10898184e3Ssthen } 11898184e3Ssthen} 12898184e3Ssthenuse ExtUtils::CBuilder; 13898184e3Ssthenuse File::Spec; 14898184e3Ssthen 15898184e3Ssthen# TEST does not like extraneous output 16898184e3Ssthenmy $quiet = $ENV{PERL_CORE} && !$ENV{HARNESS_ACTIVE}; 17898184e3Ssthenmy ($source_file, $object_file, $lib_file); 18898184e3Ssthen 19898184e3Ssthenmy $b = ExtUtils::CBuilder->new(quiet => $quiet); 20898184e3Ssthen 21898184e3Ssthen# test plan 22898184e3Ssthenif ( ! $b->have_cplusplus ) { 23898184e3Ssthen plan skip_all => "no compiler available for testing"; 24898184e3Ssthen} 25898184e3Ssthenelse { 26898184e3Ssthen plan tests => 7; 27898184e3Ssthen} 28898184e3Ssthen 29898184e3Ssthenok $b, "created EU::CB object"; 30898184e3Ssthen 31898184e3Ssthenok $b->have_cplusplus, "have_cplusplus"; 32898184e3Ssthen 33898184e3Ssthen$source_file = File::Spec->catfile('t', 'cplust.cc'); 34898184e3Ssthen{ 355759b3d2Safresh1 open my $FH, '>', $source_file or die "Can't create $source_file: $!"; 36*5486feefSafresh1 print $FH q<namespace Bogus { extern "C" int boot_cplust() { return 1; } };> . "\n"; 37898184e3Ssthen close $FH; 38898184e3Ssthen} 39898184e3Ssthenok -e $source_file, "source file '$source_file' created"; 40898184e3Ssthen 41898184e3Ssthen$object_file = $b->object_file($source_file); 42898184e3Ssthenok 1; 43898184e3Ssthen 44898184e3Ssthenis $object_file, $b->compile(source => $source_file, 'C++' => 1); 45898184e3Ssthen 466fb12b70Safresh1$lib_file = $b->lib_file($object_file, module_name => 'cplust'); 47898184e3Ssthenok 1; 48898184e3Ssthen 49898184e3Ssthenmy ($lib, @temps) = $b->link(objects => $object_file, 50898184e3Ssthen module_name => 'cplust'); 51898184e3Ssthen$lib =~ tr/"'//d; 526fb12b70Safresh1$_ = File::Spec->rel2abs($_) for $lib_file, $lib; 53898184e3Ssthenis $lib_file, $lib; 54898184e3Ssthen 55898184e3Ssthenfor ($source_file, $object_file, $lib_file) { 56898184e3Ssthen tr/"'//d; 57898184e3Ssthen 1 while unlink; 58898184e3Ssthen} 59898184e3Ssthen 60898184e3Ssthenif ($^O eq 'VMS') { 61898184e3Ssthen 1 while unlink 'CPLUST.LIS'; 62898184e3Ssthen 1 while unlink 'CPLUST.OPT'; 63898184e3Ssthen} 64898184e3Ssthen 65