diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1999-09-24 23:10:52 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-09-24 23:10:52 +0000 |
commit | 004afb30ca5f4beb99914f45551320f171c46072 (patch) | |
tree | 5f5345dc2b79960e8d5dc429e7625a4b4aed16a6 | |
parent | 290be4b17714eb14435a8d44bda86ab53196c0fc (diff) | |
parent | 84e30d1a3b7cc368d7f93dd2b009e9fd64756759 (diff) | |
download | perl-004afb30ca5f4beb99914f45551320f171c46072.tar.gz |
Integrate with Sarathy.
p4raw-id: //depot/cfgperl@4226
-rw-r--r-- | XSUB.h | 5 | ||||
-rw-r--r-- | ext/POSIX/POSIX.pod | 5 | ||||
-rw-r--r-- | ext/POSIX/POSIX.xs | 194 | ||||
-rw-r--r-- | ext/POSIX/hints/linux.pl | 4 | ||||
-rw-r--r-- | pod/perldiag.pod | 8 | ||||
-rw-r--r-- | pod/perlfunc.pod | 14 | ||||
-rw-r--r-- | pp.c | 22 | ||||
-rwxr-xr-x | t/lib/posix.t | 27 | ||||
-rwxr-xr-x | t/op/pack.t | 28 | ||||
-rw-r--r-- | toke.c | 18 | ||||
-rw-r--r-- | utils/perlcc.PL | 34 |
11 files changed, 309 insertions, 50 deletions
@@ -1,3 +1,6 @@ +#ifndef _INC_PERL_XSUB_H +#define _INC_PERL_XSUB_H 1 + #define ST(off) PL_stack_base[ax + (off)] #if defined(CYGWIN) && defined(USE_DYNAMIC_LOADING) @@ -279,3 +282,5 @@ # define socketpair PerlSock_socketpair # endif /* NO_XSLOCKS */ #endif /* PERL_CAPI */ + +#endif _INC_PERL_XSUB_H /* include guard */ diff --git a/ext/POSIX/POSIX.pod b/ext/POSIX/POSIX.pod index 75d4d1d2a6..08300e4337 100644 --- a/ext/POSIX/POSIX.pod +++ b/ext/POSIX/POSIX.pod @@ -1023,8 +1023,9 @@ about these and the other arguments. If you want your code to be portable, your format (C<fmt>) argument should use only the conversion specifiers defined by the ANSI C standard. These are C<aAbBcdHIjmMpSUwWxXyYZ%>. -On platforms that need it, the given arguments are made consistent -by calling C<mktime()> before calling your system's C<strftime()> function. +The given arguments are made consistent +as though by calling C<mktime()> before calling your system's +C<strftime()> function, except that the C<isdst> value is not affected. The string for Tuesday, December 12, 1995. diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index e828d52e5e..23c38b5e20 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -332,6 +332,196 @@ init_tm(struct tm *ptm) /* see mktime, strftime and asctime */ # define init_tm(ptm) #endif +/* + * mini_mktime - normalise struct tm values without the localtime() + * semantics (and overhead) of mktime(). + */ +static void +mini_mktime(struct tm *ptm) +{ + int yearday; + int secs; + int month, mday, year, jday; + int odd_cent, odd_year; + +#define DAYS_PER_YEAR 365 +#define DAYS_PER_QYEAR (4*DAYS_PER_YEAR+1) +#define DAYS_PER_CENT (25*DAYS_PER_QYEAR-1) +#define DAYS_PER_QCENT (4*DAYS_PER_CENT+1) +#define SECS_PER_HOUR (60*60) +#define SECS_PER_DAY (24*SECS_PER_HOUR) +/* parentheses deliberately absent on these two, otherwise they don't work */ +#define MONTH_TO_DAYS 153/5 +#define DAYS_TO_MONTH 5/153 +/* offset to bias by March (month 4) 1st between month/mday & year finding */ +#define YEAR_ADJUST (4*MONTH_TO_DAYS+1) +/* as used here, the algorithm leaves Sunday as day 1 unless we adjust it */ +#define WEEKDAY_BIAS 6 /* (1+6)%7 makes Sunday 0 again */ + +/* + * Year/day algorithm notes: + * + * With a suitable offset for numeric value of the month, one can find + * an offset into the year by considering months to have 30.6 (153/5) days, + * using integer arithmetic (i.e., with truncation). To avoid too much + * messing about with leap days, we consider January and February to be + * the 13th and 14th month of the previous year. After that transformation, + * we need the month index we use to be high by 1 from 'normal human' usage, + * so the month index values we use run from 4 through 15. + * + * Given that, and the rules for the Gregorian calendar (leap years are those + * divisible by 4 unless also divisible by 100, when they must be divisible + * by 400 instead), we can simply calculate the number of days since some + * arbitrary 'beginning of time' by futzing with the (adjusted) year number, + * the days we derive from our month index, and adding in the day of the + * month. The value used here is not adjusted for the actual origin which + * it normally would use (1 January A.D. 1), since we're not exposing it. + * We're only building the value so we can turn around and get the + * normalised values for the year, month, day-of-month, and day-of-year. + * + * For going backward, we need to bias the value we're using so that we find + * the right year value. (Basically, we don't want the contribution of + * March 1st to the number to apply while deriving the year). Having done + * that, we 'count up' the contribution to the year number by accounting for + * full quadracenturies (400-year periods) with their extra leap days, plus + * the contribution from full centuries (to avoid counting in the lost leap + * days), plus the contribution from full quad-years (to count in the normal + * leap days), plus the leftover contribution from any non-leap years. + * At this point, if we were working with an actual leap day, we'll have 0 + * days left over. This is also true for March 1st, however. So, we have + * to special-case that result, and (earlier) keep track of the 'odd' + * century and year contributions. If we got 4 extra centuries in a qcent, + * or 4 extra years in a qyear, then it's a leap day and we call it 29 Feb. + * Otherwise, we add back in the earlier bias we removed (the 123 from + * figuring in March 1st), find the month index (integer division by 30.6), + * and the remainder is the day-of-month. We then have to convert back to + * 'real' months (including fixing January and February from being 14/15 in + * the previous year to being in the proper year). After that, to get + * tm_yday, we work with the normalised year and get a new yearday value for + * January 1st, which we subtract from the yearday value we had earlier, + * representing the date we've re-built. This is done from January 1 + * because tm_yday is 0-origin. + * + * Since POSIX time routines are only guaranteed to work for times since the + * UNIX epoch (00:00:00 1 Jan 1970 UTC), the fact that this algorithm + * applies Gregorian calendar rules even to dates before the 16th century + * doesn't bother me. Besides, you'd need cultural context for a given + * date to know whether it was Julian or Gregorian calendar, and that's + * outside the scope for this routine. Since we convert back based on the + * same rules we used to build the yearday, you'll only get strange results + * for input which needed normalising, or for the 'odd' century years which + * were leap years in the Julian calander but not in the Gregorian one. + * I can live with that. + * + * This algorithm also fails to handle years before A.D. 1 gracefully, but + * that's still outside the scope for POSIX time manipulation, so I don't + * care. + */ + + year = 1900 + ptm->tm_year; + month = ptm->tm_mon; + mday = ptm->tm_mday; + /* allow given yday with no month & mday to dominate the result */ + if (ptm->tm_yday >= 0 && mday <= 0 && month <= 0) { + month = 0; + mday = 0; + jday = 1 + ptm->tm_yday; + } + else { + jday = 0; + } + if (month >= 2) + month+=2; + else + month+=14, year--; + yearday = DAYS_PER_YEAR * year + year/4 - year/100 + year/400; + yearday += month*MONTH_TO_DAYS + mday + jday; + /* + * Note that we don't know when leap-seconds were or will be, + * so we have to trust the user if we get something which looks + * like a sensible leap-second. Wild values for seconds will + * be rationalised, however. + */ + if ((unsigned) ptm->tm_sec <= 60) { + secs = 0; + } + else { + secs = ptm->tm_sec; + ptm->tm_sec = 0; + } + secs += 60 * ptm->tm_min; + secs += SECS_PER_HOUR * ptm->tm_hour; + if (secs < 0) { + if (secs-(secs/SECS_PER_DAY*SECS_PER_DAY) < 0) { + /* got negative remainder, but need positive time */ + /* back off an extra day to compensate */ + yearday += (secs/SECS_PER_DAY)-1; + secs -= SECS_PER_DAY * (secs/SECS_PER_DAY - 1); + } + else { + yearday += (secs/SECS_PER_DAY); + secs -= SECS_PER_DAY * (secs/SECS_PER_DAY); + } + } + else if (secs >= SECS_PER_DAY) { + yearday += (secs/SECS_PER_DAY); + secs %= SECS_PER_DAY; + } + ptm->tm_hour = secs/SECS_PER_HOUR; + secs %= SECS_PER_HOUR; + ptm->tm_min = secs/60; + secs %= 60; + ptm->tm_sec += secs; + /* done with time of day effects */ + /* + * The algorithm for yearday has (so far) left it high by 428. + * To avoid mistaking a legitimate Feb 29 as Mar 1, we need to + * bias it by 123 while trying to figure out what year it + * really represents. Even with this tweak, the reverse + * translation fails for years before A.D. 0001. + * It would still fail for Feb 29, but we catch that one below. + */ + jday = yearday; /* save for later fixup vis-a-vis Jan 1 */ + yearday -= YEAR_ADJUST; + year = (yearday / DAYS_PER_QCENT) * 400; + yearday %= DAYS_PER_QCENT; + odd_cent = yearday / DAYS_PER_CENT; + year += odd_cent * 100; + yearday %= DAYS_PER_CENT; + year += (yearday / DAYS_PER_QYEAR) * 4; + yearday %= DAYS_PER_QYEAR; + odd_year = yearday / DAYS_PER_YEAR; + year += odd_year; + yearday %= DAYS_PER_YEAR; + if (!yearday && (odd_cent==4 || odd_year==4)) { /* catch Feb 29 */ + month = 1; + yearday = 29; + } + else { + yearday += YEAR_ADJUST; /* recover March 1st crock */ + month = yearday*DAYS_TO_MONTH; + yearday -= month*MONTH_TO_DAYS; + /* recover other leap-year adjustment */ + if (month > 13) { + month-=14; + year++; + } + else { + month-=2; + } + } + ptm->tm_year = year - 1900; + ptm->tm_mon = month; + ptm->tm_mday = yearday; + /* re-build yearday based on Jan 1 to get tm_yday */ + year--; + yearday = year*DAYS_PER_YEAR + year/4 - year/100 + year/400; + yearday += 14*MONTH_TO_DAYS + 1; + ptm->tm_yday = jday - yearday; + /* fix tm_wday if not overridden by caller */ + if ((unsigned)ptm->tm_wday > 6) + ptm->tm_wday = (jday + WEEKDAY_BIAS) % 7; +} #ifdef HAS_LONG_DOUBLE # if LONG_DOUBLESIZE > DOUBLESIZE @@ -3652,9 +3842,7 @@ strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1) mytm.tm_wday = wday; mytm.tm_yday = yday; mytm.tm_isdst = isdst; -#if defined(HINT_STRFTIME_NEEDS_MKTIME) - (void) mktime(&mytm); -#endif + mini_mktime(&mytm); len = strftime(tmpbuf, sizeof tmpbuf, fmt, &mytm); /* ** The following is needed to handle to the situation where diff --git a/ext/POSIX/hints/linux.pl b/ext/POSIX/hints/linux.pl index 8cec446044..f1d19814ae 100644 --- a/ext/POSIX/hints/linux.pl +++ b/ext/POSIX/hints/linux.pl @@ -2,6 +2,4 @@ # Thanks to Bart Schuller <schuller@Lunatech.com> # See Message-ID: <19971009002636.50729@tanglefoot> # XXX A Configure test is needed. -$self->{CCFLAGS} = $Config{ccflags} - . ' -DHINT_STRFTIME_NEEDS_MKTIME' - . ' -DSTRUCT_TM_HASZONE -DHINT_SC_EXIST' ; +$self->{CCFLAGS} = $Config{ccflags} . ' -DSTRUCT_TM_HASZONE -DHINT_SC_EXIST' ; diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 607a410e38..551f0590aa 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -65,26 +65,26 @@ no useful value. See L<perlmod>. (F) The '!' is allowed in pack() and unpack() only after certain types. See L<perlfunc/pack>. -=item # cannot take a count +=item / cannot take a count (F) You had an unpack template indicating a counted-length string, but you have also specified an explicit size for the string. See L<perlfunc/pack>. -=item # must be followed by a, A or Z +=item / must be followed by a, A or Z (F) You had an unpack template indicating a counted-length string, which must be followed by one of the letters a, A or Z to indicate what sort of string is to be unpacked. See L<perlfunc/pack>. -=item # must be followed by a*, A* or Z* +=item / must be followed by a*, A* or Z* (F) You had an pack template indicating a counted-length string, Currently the only things that can have their length counted are a*, A* or Z*. See L<perlfunc/pack>. -=item # must follow a numeric type +=item / must follow a numeric type (F) You had an unpack template that contained a '#', but this did not follow some numeric unpack specification. diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 230dcd5c5e..237a38ddf8 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -2809,9 +2809,9 @@ C<"P"> is C<undef>. =item * -The C<"#"> character allows packing and unpacking of strings where the +The C<"/"> character allows packing and unpacking of strings where the packed structure contains a byte count followed by the string itself. -You write I<length-item>C<#>I<string-item>. +You write I<length-item>C</>I<string-item>. The I<length-item> can be any C<pack> template letter, and describes how the length value is packed. @@ -2823,9 +2823,9 @@ The I<string-item> must, at present, be C<"A*">, C<"a*"> or C<"Z*">. For C<unpack> the length of the string is obtained from the I<length-item>, but if you put in the '*' it will be ignored. - unpack 'C#a', "\04Gurusamy"; gives 'Guru' - unpack 'a3#A* A*', '007 Bond J '; gives (' Bond','J') - pack 'n#a* w#a*','hello,','world'; gives "\000\006hello,\005world" + unpack 'C/a', "\04Gurusamy"; gives 'Guru' + unpack 'a3/A* A*', '007 Bond J '; gives (' Bond','J') + pack 'n/a* w/a*','hello,','world'; gives "\000\006hello,\005world" The I<length-item> is not returned explicitly from C<unpack>. @@ -2931,6 +2931,10 @@ could know where the bytes are going to or coming from. Therefore C<pack> (and C<unpack>) handle their output and input as flat sequences of bytes. +=item * + +A comment in a TEMPLATE starts with C<#> and goes to the end of line. + =back Examples: @@ -3288,6 +3288,11 @@ PP(pp_unpack) #endif if (isSPACE(datumtype)) continue; + if (datumtype == '#') { + while (pat < patend && *pat != '\n') + pat++; + continue; + } if (*pat == '!') { char *natstr = "sSiIlL"; @@ -3347,16 +3352,16 @@ PP(pp_unpack) DIE(aTHX_ "x outside of string"); s += len; break; - case '#': + case '/': if (oldsp >= SP) - DIE(aTHX_ "# must follow a numeric type"); + DIE(aTHX_ "/ must follow a numeric type"); if (*pat != 'a' && *pat != 'A' && *pat != 'Z') - DIE(aTHX_ "# must be followed by a, A or Z"); + DIE(aTHX_ "/ must be followed by a, A or Z"); datumtype = *pat++; if (*pat == '*') pat++; /* ignore '*' for compatibility with pack */ if (isDIGIT(*pat)) - DIE(aTHX_ "# cannot take a count" ); + DIE(aTHX_ "/ cannot take a count" ); len = POPi; /* drop through */ case 'A': @@ -4345,6 +4350,11 @@ PP(pp_pack) #endif if (isSPACE(datumtype)) continue; + if (datumtype == '#') { + while (pat < patend && *pat != '\n') + pat++; + continue; + } if (*pat == '!') { char *natstr = "sSiIlL"; @@ -4371,10 +4381,10 @@ PP(pp_pack) } else len = 1; - if (*pat == '#') { + if (*pat == '/') { ++pat; if (*pat != 'a' && *pat != 'A' && *pat != 'Z' || pat[1] != '*') - DIE(aTHX_ "# must be followed by a*, A* or Z*"); + DIE(aTHX_ "/ must be followed by a*, A* or Z*"); lengthcode = sv_2mortal(newSViv(sv_len(items > 0 ? *MARK : &PL_sv_no))); } diff --git a/t/lib/posix.t b/t/lib/posix.t index 4c6aa49a05..7fb5f62177 100755 --- a/t/lib/posix.t +++ b/t/lib/posix.t @@ -14,7 +14,7 @@ use POSIX qw(fcntl_h signal_h limits_h _exit getcwd open read strftime write); use strict subs; $| = 1; -print "1..18\n"; +print "1..26\n"; $Is_W32 = $^O eq 'MSWin32'; @@ -95,6 +95,31 @@ print &POSIX::acos(1.0) == 0.0 ? "ok 17\n" : "not ok 17\n"; # See ext/POSIX/hints/sunos_4.pl and ext/POSIX/hints/linux.pl print POSIX::strftime("ok 18 # %H:%M, on %D\n", localtime()); +# If that worked, validate the mini_mktime() routine's normalisation of +# input fields to strftime(). +sub try_strftime { + my $num = shift; + my $expect = shift; + my $got = POSIX::strftime("%a %b %d %H:%M:%S %Y %j", @_); + if ($got eq $expect) { + print "ok $num\n"; + } + else { + print "# expected: $expect\n# got: $got\nnot ok $num\n"; + } +} + +$lc = &POSIX::setlocale(&POSIX::LC_TIME, 'C') if $Config{d_setlocale}; +try_strftime(19, "Wed Feb 28 00:00:00 1996 059", 0,0,0, 28,1,96); +try_strftime(20, "Thu Feb 29 00:00:60 1996 060", 60,0,-24, 30,1,96); +try_strftime(21, "Fri Mar 01 00:00:00 1996 061", 0,0,-24, 31,1,96); +try_strftime(22, "Sun Feb 28 00:00:00 1999 059", 0,0,0, 28,1,99); +try_strftime(23, "Mon Mar 01 00:00:00 1999 060", 0,0,24, 28,1,99); +try_strftime(24, "Mon Feb 28 00:00:00 2000 059", 0,0,0, 28,1,100); +try_strftime(25, "Tue Feb 29 00:00:00 2000 060", 0,0,0, 0,2,100); +try_strftime(26, "Wed Mar 01 00:00:00 2000 061", 0,0,0, 1,2,100); +&POSIX::setlocale(&POSIX::LC_TIME, $lc) if $Config{d_setlocale}; + $| = 0; # The following line assumes buffered output, which may be not true with EMX: print '@#!*$@(!@#$' unless ($^O eq 'os2' || $^O eq 'uwin' || $^O eq 'os390'); diff --git a/t/op/pack.t b/t/op/pack.t index 082b954756..092e8109cc 100755 --- a/t/op/pack.t +++ b/t/op/pack.t @@ -6,7 +6,7 @@ BEGIN { require Config; import Config; } -print "1..148\n"; +print "1..152\n"; $format = "c2 x5 C C x s d i l a6"; # Need the expression in here to force ary[5] to be numeric. This avoids @@ -354,18 +354,34 @@ print "ok ", $test++, "\n"; print "not " unless pack("V", 0xdeadbeef) eq "\xef\xbe\xad\xde"; print "ok ", $test++, "\n"; -# 143..148: # +# 143..148: / my $z; -eval { ($x) = unpack '#a*','hello' }; +eval { ($x) = unpack '/a*','hello' }; print 'not ' unless $@; print "ok $test\n"; $test++; -eval { ($z,$x,$y) = unpack 'a3#A C#a* C#Z', "003ok \003yes\004z\000abc" }; +eval { ($z,$x,$y) = unpack 'a3/A C/a* C/Z', "003ok \003yes\004z\000abc" }; print $@ eq '' && $z eq 'ok' ? "ok $test\n" : "not ok $test\n"; $test++; print $@ eq '' && $x eq 'yes' ? "ok $test\n" : "not ok $test\n"; $test++; print $@ eq '' && $y eq 'z' ? "ok $test\n" : "not ok $test\n"; $test++; -eval { ($x) = pack '#a*','hello' }; +eval { ($x) = pack '/a*','hello' }; print 'not ' unless $@; print "ok $test\n"; $test++; -$z = pack 'n#a* w#A*','string','etc'; +$z = pack 'n/a* w/A*','string','etc'; print 'not ' unless $z eq "\000\006string\003etc"; print "ok $test\n"; $test++; +# 149..152: / with # + +eval { ($z,$x,$y) = unpack <<EOU, "003ok \003yes\004z\000abc" }; + a3/A # Count in ASCII + C/a* # Count in a C char + C/Z # Count in a C char but skip after \0 +EOU +print $@ eq '' && $z eq 'ok' ? "ok $test\n" : "not ok $test\n"; $test++; +print $@ eq '' && $x eq 'yes' ? "ok $test\n" : "not ok $test\n"; $test++; +print $@ eq '' && $y eq 'z' ? "ok $test\n" : "not ok $test\n"; $test++; + +$z = pack <<EOP,'string','etc'; + n/a* # Count as network short + w/A* # Count a BER integer +EOP +print 'not ' unless $z eq "\000\006string\003etc"; print "ok $test\n"; $test++; @@ -2425,8 +2425,24 @@ Perl_yylex(pTHX) * Look for options. */ d = instr(s,"perl -"); - if (!d) + if (!d) { d = instr(s,"perl"); +#if defined(DOSISH) + /* avoid getting into infinite loops when shebang + * line contains "Perl" rather than "perl" */ + if (!d) { + for (d = ipathend-4; d >= ipath; --d) { + if ((*d == 'p' || *d == 'P') + && !ibcmp(d, "perl", 4)) + { + break; + } + } + if (d < ipath) + d = Nullch; + } +#endif + } #ifdef ALTERNATE_SHEBANG /* * If the ALTERNATE_SHEBANG on this system starts with a diff --git a/utils/perlcc.PL b/utils/perlcc.PL index 99e9b51851..a585580be0 100644 --- a/utils/perlcc.PL +++ b/utils/perlcc.PL @@ -2,6 +2,7 @@ use Config; use File::Basename qw(&basename &dirname); +use File::Spec; use Cwd; # List explicitly here the variables you want Configure to @@ -270,13 +271,14 @@ sub _createCode if (@_ == 3) # compiling a program { chmod $generated_file, 0777 & ~umask if $backend eq "Bytecode"; - + my $null=File::Spec->devnull; _print( "$^X -I@INC -MB::Stash -c $file\n", 36); - my $stash=`$^X -I@INC -MB::Stash -c $file 2>/dev/null|tail -1`; + my @stash=`$^X -I@INC -MB::Stash -c $file 2>$null`; + my $stash=$stash[-1]; chomp $stash; _print( "$^X -I@INC -MO=$backend,$stash $file\n", 36); - $return = _run("$^X -I@INC -MO=$backend,$stash $file >> $generated_file", 9); + $return = _run("$^X -I@INC -MO=$backend,$stash,-o$generated_file $file", 9); $return; } else # compiling a shared object @@ -284,7 +286,7 @@ sub _createCode _print( "$^X -I@INC -MO=$backend,-m$final_output $file\n", 36); $return = - _run("$^X -I@INC -MO=$backend,-m$final_output $file >> $generated_file", 9); + _run("$^X -I@INC -MO=$backend,-m$final_output,-o$generated_file $file ", 9); $return; } } @@ -373,7 +375,9 @@ sub _ccharness my $libs = _getSharedObjects($sourceprog); - my $cccmd = "$Config{cc} $Config{ccflags} $optimize $incdir " + my $ccflags = $Config{ccflags}; + $ccflags .= ' -DUSEIMPORTLIB' if $Config{osname} =~ /cygwin/i; + my $cccmd = "$Config{cc} $ccflags $optimize $incdir " ."@args $dynaloader $linkargs @$libs"; _print ("$cccmd\n", 36); @@ -390,17 +394,8 @@ sub _getSharedObjects my ($tmpprog); ($tmpprog = $sourceprog) =~ s"(.*)[\\/](.*)"$2"; - my $tempdir; + my $tempdir= File::Spec->tmpdir; - if ($Config{'osname'} eq 'MSWin32') - { - $tempdir = $ENV{TEMP}; - $tempdir =~ s[\\][/]g; - } - else - { - $tempdir = "/tmp"; - } $tmpfile = "$tempdir/$tmpprog.tst"; $incfile = "$tempdir/$tmpprog.val"; @@ -474,12 +469,13 @@ sub _lookforAuto my ($relabs, $relshared); my ($prefix); my $return; - + my $sharedextension = $^O =~ /MSWin32|cygwin|os2/i + ? $Config{_a} : ".$Config{so}"; ($prefix = $file) =~ s"(.*)\.pm"$1"; my ($tmp, $modname) = ($prefix =~ m"(?:(.*)[\\/]){0,1}(.*)"s); - $relshared = "$pathsep$prefix$pathsep$modname.$Config{so}"; + $relshared = "$pathsep$prefix$pathsep$modname$sharedextension"; $relabs = "$pathsep$prefix$pathsep$modname$Config{_a}"; # HACK . WHY DOES _a HAVE A '.' # AND so HAVE NONE?? @@ -614,7 +610,7 @@ sub _checkopts one file the names clash)\n"); } - if ($options->{'e'} && ($options->{'sav'} || $options->{'gen'}) && ò0 + if ($options->{'e'} && ($options->{'sav'} || $options->{'gen'}) && !$options->{'C'}) { push(@errors, @@ -766,7 +762,7 @@ sub _run sub _interruptrun { my ($command) = @_; - my $pid = open (FD, "$command 2|"); + my $pid = open (FD, "$command |"); local($SIG{HUP}) = sub { # kill 9, $pid + 1; |