Acme-Parataxis

 view release on metacpan or  search on metacpan

builder/Acme/Parataxis/Builder.pm  view on Meta::CPAN


        # C Extension Compilation - removed conditional block
        say 'Building libparataxis...';
        require Affix::Build;    # This module is used for C compilation
        require Config;
        require File::Spec;
        my $arch_dir = catdir(qw[blib arch auto Acme Parataxis]);
        mkpath( $arch_dir, $verbose );
        my $build = Affix::Build->new(
            name  => 'parataxis',
            flags => {
                cflags => join( ' ',
                    ( $Config::Config{ccflags}, '-std=c11', map { '-I' . $_ } ( File::Spec->catdir( $Config::Config{archlibexp}, 'CORE' ), 'src' ) )
                ),
                ldflags => ( $^O eq 'MSWin32' ) ?
                    ( '-L' .
                        File::Spec->catdir( $Config::Config{archlibexp}, 'CORE' ) . ' -l' .
                        ( $Config::Config{libperl} =~ s/^lib//r =~ s/\.a$//r =~ s/\.lib$//r ) .
                        ' -lws2_32' ) : ( $^O eq 'darwin' ? '-undefined dynamic_lookup' : '' )
            },
            build_dir => $arch_dir,
            clean     => 0
        );

        # Add the C source file to be compiled. It's expected to be in 'lib/Acme/'

t/007_data_types.t  view on Meta::CPAN

        }
    };
    $DESTROYED = 0;
    subtest 'Returning object from fiber' => sub {
        my $res;
        {
            my $fiber = Acme::Parataxis->new( code => sub { Local::Destructor->new('B') } );
            $res = $fiber->call();
            isa_ok $res, ['Local::Destructor'], 'Fiber returned object';

            # Fiber is technically done, but we manually flag it to ensure
            # the Perl-side wrapper drops its internal references.
            $fiber->is_done();
            is $DESTROYED, 0, 'Object still alive in parent var';
        }
        $res = undef;

        # Force a stack cycle to clear the mortal reference returned by the XS call
        flush_stack();
        is $DESTROYED, 1, 'Object destroyed in parent after release';
    };



( run in 2.077 seconds using v1.01-cache-2.11-cpan-cdf2f3d4e48 )