Debian Codegraph @

lib/FFI/Platypus/Legacy.pm

raw
1 package FFI::Platypus::Legacy;
2
3 use strict;
4 use warnings;
5 use 5.008004;
6
7 # ABSTRACT: Legacy Platypus interfaces
8 our $VERSION = '2.12'; # VERSION
9
10
11 package FFI::Platypus;
12
13 sub _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
67 1;
68
69 __END__
70
71 =pod
72
73 =encoding UTF-8
74
75 =head1 NAME
76
77 FFI::Platypus::Legacy - Legacy Platypus interfaces
78
79 =head1 VERSION
80
81 version 2.12
82
83 =head1 DESCRIPTION
84
85 This class is private to L<FFI::Platypus>.
86
87 =head1 AUTHOR
88
89 Author: Graham Ollis E<lt>[email protected]<gt>
90
91 Contributors:
92
93 Bakkiaraj Murugesan (bakkiaraj)
94
95 Dylan Cali (calid)
96
97 pipcet
98
99 Zaki Mughal (zmughal)
100
101 Fitz Elliott (felliott)
102
103 Vickenty Fesunov (vyf)
104
105 Gregor Herrmann (gregoa)
106
107 Shlomi Fish (shlomif)
108
109 Damyan Ivanov
110
111 Ilya Pavlov (Ilya33)
112
113 Petr Písař (ppisar)
114
115 Mohammad S Anwar (MANWAR)
116
117 Håkon Hægland (hakonhagland, HAKONH)
118
119 Meredith (merrilymeredith, MHOWARD)
120
121 Diab Jerius (DJERIUS)
122
123 Eric Brine (IKEGAMI)
124
125 szTheory
126
127 José Joaquín Atria (JJATRIA)
128
129 Pete Houston (openstrike, HOUSTON)
130
131 Lukas Mai (MAUKE)
132
133 =head1 COPYRIGHT AND LICENSE
134
135 This software is copyright (c) 2015-2022 by Graham Ollis.
136
137 This is free software; you can redistribute it and/or modify it under
138 the same terms as the Perl 5 programming language system itself.
139
140 =cut