1
0
Fork 0
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:
Kenichi Ishigaki 2010-02-23 12:58:08 +00:00
parent 4e16de8953
commit 2cb3b63b29

View file

@ -190,9 +190,45 @@ if ( 0 ) {
@ARGV = grep( ! /SQLITE_LOCATION|USE_LOCAL_SQLITE/, @ARGV ); @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 # Prepare Compiler Options
@ -323,46 +359,6 @@ package MY;
use Config; use Config;
sub postamble { 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;
require DBI::DBD; require DBI::DBD;
eval { eval {