#### use ExtUtils::MakeMaker; #### # See lib/ExtUtils/MakeMaker.pm for details of how to influence #### # the contents of the Makefile that is written. #### WriteMakefile( #### 'NAME' => 'SerialPort', #### 'VERSION_FROM' => 'SerialPort.pm', # finds $VERSION #### ); my $version = "0.19"; my $file = "COM1"; if (@ARGV) { $file = shift @ARGV; } my $dfile = "t/DefaultPort.pm"; unlink $dfile; print "\nCreating new $dfile\n"; open (DEFAULT, "> $dfile") or die "Can't create $dfile: $!\n"; print DEFAULT < $dfile") or die "Can't create $dfile: $!\n"; if ( $] < 5.004 ) { print DEFAULT <test.txt") || die "Can't open 'test.txt': \$!\\n"; print TXT "\\nWelcome to the Poor Man's Test::Harness\\n\\n"; my \$junk = \$Win32::API::VERSION; \$junk = \$Win32::API::pack; sub summary { my \$test = shift; print "....\$test"; print TXT "....\$test"; my \$testout = `perl \$test`; # assumes the perl 5.003 executable is in your path as "perl" if (index(\$testout, "not ok") > -1) { print "....errors found\\n"; print TXT "....errors found\\n\$testout\\n"; return 1; } print "....ok\\n"; print TXT "....ok\\n\$testout\\n"; return 0; } my \$fault = summary ("t/test1.t"); \$fault += summary ("t/test2.t"); \$fault += summary ("t/test3.t"); \$fault += summary ("t/test4.t"); \$fault += summary ("t/test5.t"); \$fault += summary ("t/test6.t"); print "All tests OK\\n" unless (\$fault); close TXT; print "\\nTo run individual tests, type:\\n"; print " C:\\> perl t/test1.t Page_Pause_Time (0..5) [ $file ]\\n"; print "\\nContinue with 'perl t/test2.t' through 'perl t/test6.t'\\n"; print "See README and other documentation for additional information.\\n\\n"; TEST3 } else { print DEFAULT < perl t/test1.t Page_Pause_Time (0..5) [ $file ]\\n"; print "\\nContinue with 'perl t/test2.t' through 'perl t/test7.t'\\n"; print "See README and other documentation for additional information.\\n\\n"; TEST4 } close DEFAULT; $dfile = "install.pl"; unlink $dfile; print "Creating new $dfile\n"; open (DEFAULT, "> $dfile") or die "Can't create $dfile: $!\n"; if ( $] < 5.004 ) { print DEFAULT < BEGIN { die "wrong version" unless (\$] =~ /^5\.003/); } use Win32::Registry; use File::Copy; sub CheckDir { my(\$dir) = \@_; if(! -d \$dir) { print "Creating directory \$dir...\\n"; mkdir(\$dir, 0) or die "ERROR: (\$!)\\n"; } } \$MODULE = "Win32::SerialPort"; print "\\n \$MODULE version $version Install Program for Build 3xx\\n"; print " Adapted from Win32::API Install Program\n"; print " by Aldo Calpini \n\n"; \$KEY = "SOFTWARE\\\\ActiveWare\\\\Perl5"; \$HKEY_LOCAL_MACHINE->Open(\$KEY, \$hkey) or die "ERROR: Can't open Perl registry key: \$KEY\\n"; \$hkey->GetValues(\$values); \$hkey->Close(); \$PRIVLIB = \$values->{'PRIVLIB'}->[2]; die "ERROR: Can't get PRIVLIB registry value!\\n" unless \$PRIVLIB; CheckDir("\$PRIVLIB\\\\Win32"); CheckDir("\$PRIVLIB\\\\Win32API"); if (copy "lib\\\\Win32\\\\SerialPort.pm","\$PRIVLIB\\\\Win32\\\\SerialPort.pm") { print "Copied Win32::SerialPort.pm to \$PRIVLIB\\\\Win32...\\n"; } else { die "Could not copy Win32::SerialPort.pm to \$PRIVLIB\\\\Win32...\\n"; } if (copy "lib\\\\Win32API\\\\CommPort.pm","\$PRIVLIB\\\\Win32API\\\\CommPort.pm") { print "Copied Win32API::CommPort.pm to \$PRIVLIB\\\\Win32API...\\n"; } else { die "Could not copy Win32API::CommPort.pm to \$PRIVLIB\\\\Win32API...\\n"; } print "Installation done\\n"; INST3 } else { print DEFAULT < "\$Config{sitearchexp}/auto/\$FULLEXT/.packlist", write => "\$Config{installsitearch}/auto/\$FULLEXT/.packlist", \$INST_LIB => "\$Config{installsitelib}", \$HTML_LIB => "\$html_dest" },1,0,0); __END__ INST4 } close DEFAULT;