mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-07 22:28:47 -04:00
DBD::SQLite: moved source modules creation a bit earlier
This commit is contained in:
parent
4e16de8953
commit
2cb3b63b29
1 changed files with 36 additions and 40 deletions
76
Makefile.PL
76
Makefile.PL
|
@ -190,9 +190,45 @@ if ( 0 ) {
|
|||
|
||||
@ARGV = grep( ! /SQLITE_LOCATION|USE_LOCAL_SQLITE/, @ARGV );
|
||||
|
||||
foreach my $file (qw/sqlite3.h sqlite3.c/) {
|
||||
(my $pm = $file) =~ tr/./_/;
|
||||
print "generating lib/DBD/SQLite/$pm.pm\n";
|
||||
open my $fh, '>', "lib/DBD/SQLite/$pm.pm" or die $!;
|
||||
print $fh <<"EOT";
|
||||
package DBD::SQLite::$pm;
|
||||
|
||||
use strict;
|
||||
our \$CODE = do { local \$/; <DATA> };
|
||||
|
||||
sub get {
|
||||
my (\$class, \$file, \$out) = \@_;
|
||||
my \$got;
|
||||
if (\$file) {
|
||||
(\$got) = \$CODE =~ m{(
|
||||
/\\*+[ ]Begin[ ]file[ ]\$file[ ]\\*+
|
||||
.+?
|
||||
/\\*+[ ]End[ ]of[ ]\$file[ ]\\*+/
|
||||
)}sx;
|
||||
}
|
||||
else {
|
||||
\$got = \$CODE;
|
||||
}
|
||||
if (\$got && \$out) {
|
||||
open my \$fh, '>', \$out or die \$!;
|
||||
print \$fh \$got;
|
||||
}
|
||||
return \$got ? \$got : '';
|
||||
}
|
||||
|
||||
1;
|
||||
\__DATA__
|
||||
EOT
|
||||
print $fh do {
|
||||
local $/;
|
||||
open my $in, '<', $file or die $!;
|
||||
<$in>;
|
||||
};
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# Prepare Compiler Options
|
||||
|
@ -323,46 +359,6 @@ package MY;
|
|||
use Config;
|
||||
|
||||
sub postamble {
|
||||
foreach my $file (qw/sqlite3.h sqlite3.c/) {
|
||||
(my $pm = $file) =~ tr/./_/;
|
||||
print "generating lib/DBD/SQLite/$pm.pm\n";
|
||||
open my $fh, '>', "lib/DBD/SQLite/$pm.pm" or die $!;
|
||||
print $fh <<"EOT";
|
||||
package DBD::SQLite::$pm;
|
||||
|
||||
use strict;
|
||||
our \$CODE = do { local \$/; <DATA> };
|
||||
|
||||
sub get {
|
||||
my (\$class, \$file, \$out) = \@_;
|
||||
my \$got;
|
||||
if (\$file) {
|
||||
(\$got) = \$CODE =~ m{(
|
||||
/\\*+[ ]Begin[ ]file[ ]\$file[ ]\\*+
|
||||
.+?
|
||||
/\\*+[ ]End[ ]of[ ]\$file[ ]\\*+/
|
||||
)}sx;
|
||||
}
|
||||
else {
|
||||
\$got = \$CODE;
|
||||
}
|
||||
if (\$got && \$out) {
|
||||
open my \$fh, '>', \$out or die \$!;
|
||||
print \$fh \$got;
|
||||
}
|
||||
return \$got ? \$got : '';
|
||||
}
|
||||
|
||||
1;
|
||||
\__DATA__
|
||||
EOT
|
||||
print $fh do {
|
||||
local $/;
|
||||
open my $in, '<', $file or die $!;
|
||||
<$in>;
|
||||
};
|
||||
}
|
||||
|
||||
require DBI;
|
||||
require DBI::DBD;
|
||||
eval {
|
||||
|
|
Loading…
Add table
Reference in a new issue