.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Test::Alien::Synthetic 3" .TH Test::Alien::Synthetic 3 2023-07-25 "perl v5.38.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Test::Alien::Synthetic \- A mock alien object for testing .SH VERSION .IX Header "VERSION" version 2.80 .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& use Test2::V0; \& use Test::Alien; \& \& my $alien = synthetic { \& cflags => \*(Aq\-I/foo/bar/include\*(Aq, \& libs => \*(Aq\-L/foo/bar/lib \-lbaz\*(Aq, \& }; \& \& alien_ok $alien; \& \& done_testing; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This class is used to model a synthetic Alien class that implements the minimum Alien::Base interface needed by Test::Alien. .PP It can be useful if you have a non\-Alien::Base based Alien distribution that you need to test. .PP \&\fBNOTE\fR: The name of this class may move in the future, so do not refer to this class name directly. Instead create instances of this class using the Test::Alien#synthetic function. .SH ATTRIBUTES .IX Header "ATTRIBUTES" .SS cflags .IX Subsection "cflags" String containing the compiler flags .SS cflags_static .IX Subsection "cflags_static" String containing the static compiler flags .SS libs .IX Subsection "libs" String containing the linker and library flags .SS libs_static .IX Subsection "libs_static" String containing the static linker and library flags .SS dynamic_libs .IX Subsection "dynamic_libs" List reference containing the dynamic libraries. .SS bin_dir .IX Subsection "bin_dir" Tool binary directory. .SS runtime_prop .IX Subsection "runtime_prop" Runtime properties. .SH EXAMPLE .IX Header "EXAMPLE" Here is a complete example using Alien::Libarchive which is a non\-Alien::Base based Alien distribution. .PP .Vb 5 \& use strict; \& use warnings; \& use Test2::V0; \& use Test::Alien; \& use Alien::Libarchive; \& \& my $real = Alien::Libarchive\->new; \& my $alien = synthetic { \& cflags => scalar $real\->cflags, \& libs => scalar $real\->libs, \& dynamic_libs => [$real\->dlls], \& }; \& \& alien_ok $alien; \& \& xs_ok do { local $/; }, with_subtest { \& my($module) = @_; \& my $ptr = $module\->archive_read_new; \& like $ptr, qr{^[0\-9]+$}; \& $module\->archive_read_free($ptr); \& }; \& \& ffi_ok { symbols => [qw( archive_read_new )] }, with_subtest { \& my($ffi) = @_; \& my $new = $ffi\->function(archive_read_new => [] => \*(Aqopaque\*(Aq); \& my $free = $ffi\->function(archive_read_close => [\*(Aqopaque\*(Aq] => \*(Aqvoid\*(Aq); \& my $ptr = $new\->(); \& like $ptr, qr{^[0\-9]+$}; \& $free\->($ptr); \& }; \& \& done_testing; \& \& _\|_DATA_\|_ \& \& #include "EXTERN.h" \& #include "perl.h" \& #include "XSUB.h" \& #include \& \& MODULE = TA_MODULE PACKAGE = TA_MODULE \& \& void *archive_read_new(class); \& const char *class; \& CODE: \& RETVAL = (void*) archive_read_new(); \& OUTPUT: \& RETVAL \& \& void archive_read_free(class, ptr); \& const char *class; \& void *ptr; \& CODE: \& archive_read_free(ptr); .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" .IP Test::Alien 4 .IX Item "Test::Alien" .SH AUTHOR .IX Header "AUTHOR" Author: Graham Ollis .PP Contributors: .PP Diab Jerius (DJERIUS) .PP Roy Storey (KIWIROY) .PP Ilya Pavlov .PP David Mertens (run4flat) .PP Mark Nunberg (mordy, mnunberg) .PP Christian Walde (Mithaldu) .PP Brian Wightman (MidLifeXis) .PP Zaki Mughal (zmughal) .PP mohawk (mohawk2, ETJ) .PP Vikas N Kumar (vikasnkumar) .PP Flavio Poletti (polettix) .PP Salvador Fandiño (salva) .PP Gianni Ceccarelli (dakkar) .PP Pavel Shaydo (zwon, trinitum) .PP Kang-min Liu (劉康民, gugod) .PP Nicholas Shipp (nshp) .PP Juan Julián Merelo Guervós (JJ) .PP Joel Berger (JBERGER) .PP Petr Písař (ppisar) .PP Lance Wicks (LANCEW) .PP Ahmad Fatoum (a3f, ATHREEF) .PP José Joaquín Atria (JJATRIA) .PP Duke Leto (LETO) .PP Shoichi Kaji (SKAJI) .PP Shawn Laffan (SLAFFAN) .PP Paul Evans (leonerd, PEVANS) .PP Håkon Hægland (hakonhagland, HAKONH) .PP nick nauwelaerts (INPHOBIA) .PP Florian Weimer .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2011\-2022 by Graham Ollis. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.