1package FFI::Platypus::Legacy;
2
3use strict;
4use warnings;
5use 5.008004;
6
7# ABSTRACT: Legacy Platypus interfaces
8our $VERSION = '1.56'; # VERSION
9
10
11package FFI::Platypus;
12
13sub _package
14{
15  my($self, $module, $modlibname) = @_;
16
17  ($module, $modlibname) = caller unless defined $modlibname;
18  my @modparts = split /::/, $module;
19  my $modfname = $modparts[-1];
20  my $modpname = join('/',@modparts);
21  my $c = @modparts;
22  $modlibname =~ s,[\\/][^\\/]+$,, while $c--;    # Q&D basename
23
24  {
25    my @maybe = (
26      "$modlibname/auto/$modpname/$modfname.txt",
27      "$modlibname/../arch/auto/$modpname/$modfname.txt",
28    );
29    foreach my $file (@maybe)
30    {
31      if(-f $file)
32      {
33        open my $fh, '<', $file;
34        my $line = <$fh>;
35        close $fh;
36        if($line =~ /^FFI::Build\@(.*)$/)
37        {
38          $self->lib("$modlibname/$1");
39          return $self;
40        }
41      }
42    }
43  }
44
45  require FFI::Platypus::ShareConfig;
46  my @dlext = @{ FFI::Platypus::ShareConfig->get("config_dlext") };
47
48  foreach my $dlext (@dlext)
49  {
50    my $file = "$modlibname/auto/$modpname/$modfname.$dlext";
51    unless(-e $file)
52    {
53      $modlibname =~ s,[\\/][^\\/]+$,,;
54      $file = "$modlibname/arch/auto/$modpname/$modfname.$dlext";
55    }
56
57    if(-e $file)
58    {
59      $self->lib($file);
60      return $self;
61    }
62  }
63
64  $self;
65}
66
671;
68
69__END__
70
71=pod
72
73=encoding UTF-8
74
75=head1 NAME
76
77FFI::Platypus::Legacy - Legacy Platypus interfaces
78
79=head1 VERSION
80
81version 1.56
82
83=head1 DESCRIPTION
84
85This class is private to L<FFI::Platypus>.
86
87=head1 AUTHOR
88
89Author: Graham Ollis E<lt>plicease@cpan.orgE<gt>
90
91Contributors:
92
93Bakkiaraj Murugesan (bakkiaraj)
94
95Dylan Cali (calid)
96
97pipcet
98
99Zaki Mughal (zmughal)
100
101Fitz Elliott (felliott)
102
103Vickenty Fesunov (vyf)
104
105Gregor Herrmann (gregoa)
106
107Shlomi Fish (shlomif)
108
109Damyan Ivanov
110
111Ilya Pavlov (Ilya33)
112
113Petr Písař (ppisar)
114
115Mohammad S Anwar (MANWAR)
116
117Håkon Hægland (hakonhagland, HAKONH)
118
119Meredith (merrilymeredith, MHOWARD)
120
121Diab Jerius (DJERIUS)
122
123Eric Brine (IKEGAMI)
124
125szTheory
126
127José Joaquín Atria (JJATRIA)
128
129Pete Houston (openstrike, HOUSTON)
130
131=head1 COPYRIGHT AND LICENSE
132
133This software is copyright (c) 2015,2016,2017,2018,2019,2020 by Graham Ollis.
134
135This is free software; you can redistribute it and/or modify it under
136the same terms as the Perl 5 programming language system itself.
137
138=cut
139