diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2001-04-06 06:58:44 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2001-04-06 06:58:44 +0000 |
commit | 74a759fbea03c23ba6f4607fa104ce58409a1bed (patch) | |
tree | f03c70db4a004b7a381229452cb27ee5a6a24946 | |
parent | e6fbcc36a54a8afd8dbcdcb9a8d8e178df530b97 (diff) | |
download | perl-74a759fbea03c23ba6f4607fa104ce58409a1bed.tar.gz |
integrate changes#9555,9556,9563..9567,9570..9575,9577..9578
from mainline
Subject: [PATCH] Base64 update to perlfaq9.pod
Subject: [PATCH AUTHORS] Housekeeping
Subject: Re: Not OK: perl v5.6.1 +fools-gold on darwin 1.3 (UNINSTALLED)
Mac OS X (Darwin) has extra pwent fields.
Subject: [PATCH B::*] print control-character vars readably
Needs EBCDICification.
Subject: [PATCH B::Deparse] lexical variables with ridiculously long names that are used in list assignments
Subject: [PATCH B::*] cope with SVf_IVisUV, and cope with $^^ and friends
Subject: [PATCH B::Deparse] "${foo}bar", "${foo}[1]" etc.
Subject: [PATCH B::Deparse] binmode is no longer an UNOP
Subject: [PATCH B::Deparse] regex quoting, and a minor milestone
Subject: [PATCH B::Deparse] suppress "unintialized value" warnings
Subject: bleadperl / hex ignores variable length and/or tr doesn't null terminate ( with patch)
Subject: patch for t/op/oct.t that shows need for patch supplied with bug 20010404.009, (bugs in hex and oct)
FreeBSD hints tweak from Anton Berezin.
Subject: [PATCH foolperl & bleadperl] README.vms update
Subject: Re: [PATCH foolperl & bleadperl] README.vms update
p4raw-link: @9570 on //depot/perl: 82bafd27c447b694ac8afacb18ba6e4892659fc4
p4raw-link: @9567 on //depot/perl: 8fed110457227e00a470209fe85c3213e99600a1
p4raw-link: @9563 on //depot/perl: 32b4ad3c69185f4ce7cd382edebd968b87bc3e6f
p4raw-link: @9556 on //depot/perl: 9801c297f4e45281257bb32f9ed235b15af367e0
p4raw-link: @9555 on //depot/perl: 6a0af2f17bcde4767b90a72eff7083c5effff21d
p4raw-id: //depot/maint-5.6/perl@9585
p4raw-integrated: from //depot/perl@9584 'copy in' t/op/pwent.t
(@6874..) t/op/oct.t (@7212..) hints/freebsd.sh (@7395..)
pod/perlfaq9.pod (@8839..) AUTHORS (@9139..) ext/B/B/Debug.pm
(@9460..) ext/B/B/Concise.pm (@9522..) ext/B/B/Terse.pm
(@9564..) README.vms (@9577..) 'edit in' ext/B/B.pm (@9564..)
ext/B/B/Deparse.pm (@9571..) 'merge in' pp.c (@9405..)
-rw-r--r-- | AUTHORS | 2 | ||||
-rw-r--r-- | README.vms | 84 | ||||
-rw-r--r-- | ext/B/B.pm | 44 | ||||
-rw-r--r-- | ext/B/B/Concise.pm | 4 | ||||
-rw-r--r-- | ext/B/B/Debug.pm | 4 | ||||
-rw-r--r-- | ext/B/B/Deparse.pm | 46 | ||||
-rw-r--r-- | ext/B/B/Terse.pm | 7 | ||||
-rw-r--r-- | hints/freebsd.sh | 3 | ||||
-rw-r--r-- | pod/perlfaq9.pod | 13 | ||||
-rw-r--r-- | pp.c | 22 | ||||
-rwxr-xr-x | t/op/oct.t | 11 | ||||
-rwxr-xr-x | t/op/pwent.t | 9 |
12 files changed, 164 insertions, 85 deletions
@@ -402,7 +402,7 @@ Paul David Fardy <pdf@morgan.ucs.mun.ca> Paul Green <Paul_Green@stratus.com> Paul Hoffman <phoffman@proper.com> Paul Holser <Paul.Holser.pholser@nortelnetworks.com> -Paul Johnson <pjcj@transeda.com> +Paul Johnson <paul@pjcj.net> Paul Marquess <Paul.Marquess@btinternet.com> Paul Moore <Paul.Moore@uk.origin-it.com> Paul Rogers <Paul.Rogers@Central.Sun.COM> diff --git a/README.vms b/README.vms index 8378adc3e3..4e2ae490a5 100644 --- a/README.vms +++ b/README.vms @@ -29,7 +29,7 @@ install. Also note that, as of Perl version 5.005 and later, an ANSI C compliant compiler is required to build Perl. VAX C is *not* ANSI compliant, as it died a natural death some time before the standard was set. Therefore -VAX C will not compile perl 5.005. We are sorry about that. +VAX C will not compile Perl 5.005 or later. We are sorry about that. If you are stuck without DEC C (the VAX C license should be good for DEC C, but the media charges might prohibit an upgrade), consider getting Gnu C @@ -52,7 +52,8 @@ to lend a hand we'd love to have you. Join the Perl Porting Team Now! The current sources and build procedures have been tested on a VAX using DEC C, and on an AXP using DEC C. If you run into problems with -other compilers, please let us know. +other compilers, please let us know. (Note: DEC C was renamed to Compaq C +around version 6.2). There are issues with various versions of DEC C, so if you're not running a relatively modern version, check the "DEC C issues" section later on in this @@ -66,7 +67,7 @@ In addition to VMS and DCL you will need two things: =item 1 A C compiler. -DEC C or gcc for VMS (AXP or VAX). +DEC (now Compaq) C or gcc for VMS (AXP or VAX). =item 2 A make tool. @@ -91,11 +92,9 @@ of web/ftp sites and is distributed on the OpenVMS Freeware CD-ROM from Compaq. http://www.fsf.org/order/ftp.html - ftp://ftp.uu.net/archive/systems/gnu/diffutils*.tar.gz - ftp://gatekeeper.dec.com/pub/GNU/diffutils*.tar.gz - ftp://ftp.gnu.org/pub/gnu/diffutils*.tar.gz http://www.openvms.compaq.com/freeware/GZIP/ ftp://ftp.compaq.com/pub/VMS/ + http://www.crinoid.com/utils/ =item 2 VMS TAR @@ -129,6 +128,15 @@ library on VMS. Most and slang are available from: ftp://space.mit.edu/pub/davis/ ftp://ftp.wku.edu/vms/narnia/most.zip +=item 5 GNU PATCH and DIFFUTILS for VMS + +Patches to Perl are usually distributed as GNU unified or contextual diffs. +Such patches are created by the GNU diff program (part of the diffutils +distribution) and applied with GNU patch. VMS ports of these utilities are +available here: + + http://www.crinoid.com/utils/ + =back Please note that UNZIP and GUNZIP are not the same thing (they work with @@ -180,8 +188,13 @@ As a handy shortcut, the command: (note the quotation marks and case) will choose reasonable defaults automatically (it takes DEC C over Gnu C, DEC C sockets over SOCKETSHR -sockets, and either over no sockets). More help with configure.com is -available from: +sockets, and either over no sockets). Some options can be given +explicitly on the command line; the following example specifies a +non-default location for where Perl will be installed: + + @ Configure "-d" "-Dprefix=dka100:[utils.perl5.]" + +More help with configure.com is available from: @ Configure "-h" @@ -341,19 +354,17 @@ and adjust if necessary with SET PROTECTION=(code)/DEFAULT. =item 2 -Create a directory somewhere and either run @perl_setup or -define the concealed logical PERL_ROOT to point to it by hand. -For example, - - CREATE/DIRECTORY dka200:[perl] - @PERL_SETUP - SHOW LOGICAL PERL_ROOT - -or, - - CREATE/DIRECTORY dka200:[perl] - DEFINE/TRANS=(CONC,TERM) PERL_ROOT dka200:[perl.] +Decide where you want Perl to be installed (unless you have already done so +by using the "prefix" configuration parameter -- see the example in the +"Configuring the Perl build" section). +The DCL script PERL_SETUP.COM that is written by CONFIGURE.COM will help you +with the definition of the PERL_ROOT and PERLSHR logical names and the PERL +foreign command symbol. Take a look at PERL_SETUP.COM and modify it if you +want to. The installation process will execute PERL_SETUP.COM and copy +files to the directory tree pointed to by the PERL_ROOT logical name defined +there, so make sure that you have write access to the parent directory of +what will become the root of your Perl installation. =item 3 @@ -370,10 +381,8 @@ throw a /FORCE switch on the MMS or MMK command. =back -The DCL script PERL_SETUP.COM that is written by CONFIGURE.COM -will help you with the definition of PERL_ROOT, PERLSHR and the PERL -Foreign symbol. Take a look at PERL_SETUP.COM and modify it if you want -to. Then copy PERL_SETUP.COM to a place accessible to your perl users. +Copy PERL_SETUP.COM to a place accessible to your perl users. + For example: COPY PERL_SETUP.COM SYS$LIBRARY: @@ -419,7 +428,7 @@ You'll need CMKRNL privilege to install the new dcltables.exe. On systems that are using perl quite a bit, and particularly those with minimal RAM, you can boost the performance of perl by INSTALLing it as -a known image. PERLSHR.EXE is typically larger than 2000 blocks +a known image. PERLSHR.EXE is typically larger than 2500 blocks and that is a reasonably large amount of IO to load each time perl is invoked. @@ -538,30 +547,30 @@ specific issues (including both Perl questions and installation problems) there is the VMSPERL mailing list. It is usually a low-volume (10-12 messages a week) mailing list. -The subscription address is MAJORDOMO@PERL.ORG. Send a mail message with -just the words SUBSCRIBE VMSPERL in the body of the message. - -The VMSPERL mailing list address is VMSPERL@PERL.ORG. Any mail sent there -gets echoed to all subscribers of the list. There is a searchable archive of -the list on the web at: +To subscribe, send a mail message to VMSPERL-SUBSCRIBE@PERL.ORG. The VMSPERL +mailing list address is VMSPERL@PERL.ORG. Any mail sent there gets echoed +to all subscribers of the list. There is a searchable archive of the list +on the web at: http://www.xray.mpe.mpg.de/mailing-lists/vmsperl/ -To unsubscribe from VMSPERL send the message UNSUBSCRIBE VMSPERL to -MAJORDOMO@PERL.ORG. Be sure to do so from the subscribed account that -you are canceling. +To unsubscribe from VMSPERL send a message to VMSPERL-UNSUBSCRIBE@PERL.ORG. +Be sure to do so from the subscribed account that you are canceling. =head2 Web sites Vmsperl pages on the web include: http://www.sidhe.org/vmsperl/index.html + http://www.crinoid.com/ http://duphy4.physics.drexel.edu/pub/cgi_info.htmlx - http://www.xray.mpe.mpg.de/mailing-lists/vmsperl/ http://www.cpan.org/modules/by-module/VMS/ + http://www.xray.mpe.mpg.de/mailing-lists/vmsperl/ http://nucwww.chem.sunysb.edu/htbin/software_list.cgi http://www.best.com/~pvhp/vms/ http://bkfug.kfunigraz.ac.at/~binder/perl.html + http://lists.perl.org/showlist.cgi?name=vmsperl + http://archive.develooper.com/vmsperl@perl.org/ =head1 SEE ALSO @@ -572,8 +581,9 @@ of extending vmsperl with CPAN modules after Perl has been installed. =head1 AUTHORS -Last revised 25-February-2000 by Peter Prymmer pvhp@best.com. -Revised 27-October-1999 by Craig Berry craig.berry@metamorgs.com. +Revised 5-April-2001 by Craig Berry craigberry@mac.com. +Revised 25-February-2000 by Peter Prymmer pvhp@best.com. +Revised 27-October-1999 by Craig Berry craigberry@mac.com. Revised 01-March-1999 by Dan Sugalski dan@sidhe.org. Originally by Charles Bailey bailey@newman.upenn.edu. diff --git a/ext/B/B.pm b/ext/B/B.pm index d6bd47c9c1..c58e769a84 100644 --- a/ext/B/B.pm +++ b/ext/B/B.pm @@ -60,6 +60,21 @@ use strict; package B::OBJECT; } +sub B::GV::SAFENAME { + my $name = (shift())->NAME; + + # The regex below corresponds to the isCONTROLVAR macro + # from toke.c + + $name =~ s/^([\cA-\cZ\c\\c[\c]\c?\c_\c^])/"^".chr(64 ^ ord($1))/e; + return $name; +} + +sub B::IV::int_value { + my ($self) = @_; + return (($self->FLAGS() & SVf_IVisUV()) ? $self->UVX : $self->IV); +} + my $debug; my $op_count = 0; my @parents = (); @@ -333,8 +348,22 @@ C<REFCNT> (corresponding to the C function C<SvREFCNT>). =item IV +Returns the value of the IV, I<interpreted as +a signed integer>. This will be misleading +if C<FLAGS & SVf_IVisUV>. Perhaps you want the +C<int_value> method instead? + =item IVX +=item UVX + +=item int_value + +This method returns the value of the IV as an integer. +It differs from C<IV> in that it returns the correct +value regardless of whether it's stored signed or +unsigned. + =item needs64bits =item packiv @@ -449,6 +478,21 @@ This method returns TRUE if the GP field of the GV is NULL. =item NAME +=item SAFENAME + +This method returns the name of the glob, but if the first +character of the name is a control character, then it converts +it to ^X first, so that *^G would return "^G" rather than "\cG". + +It's useful if you want to print out the name of a variable. +If you restrict yourself to globs which exist at compile-time +then the result ought to be unambiguous, because code like +C<${"^G"} = 1> is compiled as two ops - a constant string and +a dereference (rv2gv) - so that the glob is created at runtime. + +If you're working with globs at runtime, and need to disambiguate +*^G from *{"^G"}, then you should use the raw NAME method. + =item STASH =item SV diff --git a/ext/B/B/Concise.pm b/ext/B/B/Concise.pm index 2dd43a932a..cb352ebf1c 100644 --- a/ext/B/B/Concise.pm +++ b/ext/B/B/Concise.pm @@ -385,8 +385,8 @@ sub concise_op { } else { $stash = $stash . "::"; } - $h{arg} = "(*$stash" . $gv->NAME . ")"; - $h{svval} = "*$stash" . $gv->NAME; + $h{arg} = "(*$stash" . $gv->SAFENAME . ")"; + $h{svval} = "*$stash" . $gv->SAFENAME; } else { while (class($sv) eq "RV") { $h{svval} .= "\\"; diff --git a/ext/B/B/Debug.pm b/ext/B/B/Debug.pm index 71540a1bc7..049195b423 100644 --- a/ext/B/B/Debug.pm +++ b/ext/B/B/Debug.pm @@ -218,14 +218,14 @@ EOT sub B::GV::debug { my ($gv) = @_; if ($done_gv{$$gv}++) { - printf "GV %s::%s\n", $gv->STASH->NAME, $gv->NAME; + printf "GV %s::%s\n", $gv->STASH->NAME, $gv->SAFENAME; return; } my ($sv) = $gv->SV; my ($av) = $gv->AV; my ($cv) = $gv->CV; $gv->B::SV::debug; - printf <<'EOT', $gv->NAME, $gv->STASH->NAME, $gv->STASH, $$sv, $gv->GvREFCNT, $gv->FORM, $$av, ${$gv->HV}, ${$gv->EGV}, $$cv, $gv->CVGEN, $gv->LINE, $gv->FILE, $gv->GvFLAGS; + printf <<'EOT', $gv->SAFENAME, $gv->STASH->NAME, $gv->STASH, $$sv, $gv->GvREFCNT, $gv->FORM, $$av, ${$gv->HV}, ${$gv->EGV}, $$cv, $gv->CVGEN, $gv->LINE, $gv->FILE, $gv->GvFLAGS; NAME %s STASH %s (0x%x) SV 0x%x diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index 7a1856b5d7..ead02e14a8 100644 --- a/ext/B/B/Deparse.pm +++ b/ext/B/B/Deparse.pm @@ -350,6 +350,10 @@ sub new { $self->{'cuddle'} = "\n"; $self->{'indent_size'} = 4; $self->{'use_tabs'} = 0; + $self->{'expand'} = 0; + $self->{'unquote'} = 0; + $self->{'linenums'} = 0; + $self->{'parens'} = 0; $self->{'ex_const'} = "'???'"; while (my $arg = shift @_) { if (substr($arg, 0, 2) eq "-u") { @@ -769,7 +773,7 @@ sub gv_name { my $self = shift; my $gv = shift; my $stash = $gv->STASH->NAME; - my $name = $gv->NAME; + my $name = $gv->SAFENAME; if ($stash eq $self->{'curstash'} or $globalnames{$name} or $name =~ /^[^A-Za-z_]/) { @@ -777,9 +781,8 @@ sub gv_name { } else { $stash = $stash . "::"; } - if ($name =~ /^([\cA-\cZ])(.*)$/) { - $name = "^" . chr(64 + ord($1)) . $2; - $name = "{$name}" if length($2); # ${^WARNING_BITS} etc + if ($name =~ /^\^../) { + $name = "{$name}"; # ${^WARNING_BITS} etc } return $stash . $name; } @@ -940,7 +943,6 @@ sub pp_prototype { unop(@_, "prototype") } sub pp_close { unop(@_, "close") } sub pp_fileno { unop(@_, "fileno") } sub pp_umask { unop(@_, "umask") } -sub pp_binmode { unop(@_, "binmode") } sub pp_untie { unop(@_, "untie") } sub pp_tied { unop(@_, "tied") } sub pp_dbmclose { unop(@_, "dbmclose") } @@ -1483,6 +1485,7 @@ sub pp_return { listop(@_, "return") } sub pp_open { listop(@_, "open") } sub pp_pipe_op { listop(@_, "pipe") } sub pp_tie { listop(@_, "tie") } +sub pp_binmode { listop(@_, "binmode") } sub pp_dbmopen { listop(@_, "dbmopen") } sub pp_sselect { listop(@_, "select") } sub pp_select { listop(@_, "select") } @@ -1866,21 +1869,10 @@ sub pp_null { } } -# the aassign in-common check messes up SvCUR (always setting it -# to a value >= 100), but it's probably safe to assume there -# won't be any NULs in the names of my() variables. (with -# stash variables, I wouldn't be so sure) -sub padname_fix { - my $str = shift; - $str = substr($str, 0, index($str, "\0")) if index($str, "\0") != -1; - return $str; -} - sub padname { my $self = shift; my $targ = shift; - my $str = $self->padname_sv($targ)->PV; - return padname_fix($str); + return $self->padname_sv($targ)->PVX; } sub padany { @@ -2381,7 +2373,7 @@ sub const { if (class($sv) eq "SPECIAL") { return ('undef', '1', '0')[$$sv-1]; # sv_undef, sv_yes, sv_no } elsif ($sv->FLAGS & SVf_IOK) { - return $sv->IV; + return $sv->int_value; } elsif ($sv->FLAGS & SVf_NOK) { return $sv->NV; } elsif ($sv->FLAGS & SVf_ROK) { @@ -2424,7 +2416,13 @@ sub dq { if ($type eq "const") { return uninterp(escape_str(unback($self->const_sv($op)->PV))); } elsif ($type eq "concat") { - return $self->dq($op->first) . $self->dq($op->last); + my $first = $self->dq($op->first); + my $last = $self->dq($op->last); + # Disambiguate "${foo}bar", "${foo}{bar}", "${foo}[1]" + if ($last =~ /^[{\[\w]/) { + $first =~ s/([%\$@])([A-Za-z_]\w*)$/${1}{$2}/; + } + return $first . $last; } elsif ($type eq "uc") { return '\U' . $self->dq($op->first->sibling) . '\E'; } elsif ($type eq "lc") { @@ -2711,9 +2709,15 @@ sub re_dq { my $op = shift; my $type = $op->name; if ($type eq "const") { - return uninterp($self->const_sv($op)->PV); + return re_uninterp($self->const_sv($op)->PV); } elsif ($type eq "concat") { - return $self->re_dq($op->first) . $self->re_dq($op->last); + my $first = $self->re_dq($op->first); + my $last = $self->re_dq($op->last); + # Disambiguate "${foo}bar", "${foo}{bar}", "${foo}[1]" + if ($last =~ /^[{\[\w]/) { + $first =~ s/([%\$@])([A-Za-z_]\w*)$/${1}{$2}/; + } + return $first . $last; } elsif ($type eq "uc") { return '\U' . $self->re_dq($op->first->sibling) . '\E'; } elsif ($type eq "lc") { diff --git a/ext/B/B/Terse.pm b/ext/B/B/Terse.pm index 8f669b463f..52f0549911 100644 --- a/ext/B/B/Terse.pm +++ b/ext/B/B/Terse.pm @@ -1,7 +1,7 @@ package B::Terse; use strict; use B qw(peekop class walkoptree walkoptree_exec walkoptree_slow - main_start main_root cstring svref_2object); + main_start main_root cstring svref_2object SVf_IVisUV); use B::Asmdata qw(@specialsv_name); sub terse { @@ -102,13 +102,14 @@ sub B::GV::terse { $stash = $stash . "::"; } print indent($level); - printf "%s (0x%lx) *%s%s\n", class($gv), $$gv, $stash, $gv->NAME; + printf "%s (0x%lx) *%s%s\n", class($gv), $$gv, $stash, $gv->SAFENAME; } sub B::IV::terse { my ($sv, $level) = @_; print indent($level); - printf "%s (0x%lx) %d\n", class($sv), $$sv, $sv->IV; + my $v = $sv->FLAGS & SVf_IVisUV ? "%u" : "%d"; + printf "%s (0x%lx) $v\n", class($sv), $$sv, $sv->int_value; } sub B::NV::terse { diff --git a/hints/freebsd.sh b/hints/freebsd.sh index cc48351879..8eb6ac47b0 100644 --- a/hints/freebsd.sh +++ b/hints/freebsd.sh @@ -187,7 +187,8 @@ EOM POSIX threads are not supported well by FreeBSD $osvers. Please consider upgrading to at least FreeBSD 2.2.8, -or preferably to 3.something. +or preferably to the most recent -RELEASE or -STABLE +version (see http://www.freebsd.org/releases/). (While 2.2.7 does have pthreads, it has some problems with the combination of threads and pipes and therefore diff --git a/pod/perlfaq9.pod b/pod/perlfaq9.pod index d234cf43a9..2609c4482e 100644 --- a/pod/perlfaq9.pod +++ b/pod/perlfaq9.pod @@ -388,13 +388,18 @@ with the characters reversed, one added or subtracted to each digit, etc. =head2 How do I decode a MIME/BASE64 string? -The MIME-tools package (available from CPAN) handles this and a lot -more. Decoding BASE64 becomes as simple as: +The MIME-Base64 package (available from CPAN) handles this as well as +the MIME/QP encoding. Decoding BASE64 becomes as simple as: - use MIME::base64; + use MIME::Base64; $decoded = decode_base64($encoded); -A more direct approach is to use the unpack() function's "u" +The MIME-Tools package (available from CPAN) support exctraction with +decoding of BASE64 encoded attachments and content directly from email +messages. + +If the string to decode is short (less than 84 bytes long) +a more direct approach is to use the unpack() function's "u" format after minor transliterations: tr#A-Za-z0-9+/##cd; # remove non-base64 chars @@ -1968,11 +1968,11 @@ PP(pp_hex) dSP; dTARGET; char *tmps; STRLEN argtype; - STRLEN n_a; + STRLEN len; - tmps = POPpx; + tmps = (SvPVx(POPs, len)); argtype = 1; /* allow underscores */ - XPUSHn(scan_hex(tmps, 99, &argtype)); + XPUSHn(scan_hex(tmps, len, &argtype)); RETURN; } @@ -1982,20 +1982,20 @@ PP(pp_oct) NV value; STRLEN argtype; char *tmps; - STRLEN n_a; + STRLEN len; - tmps = POPpx; - while (*tmps && isSPACE(*tmps)) - tmps++; + tmps = (SvPVx(POPs, len)); + while (*tmps && len && isSPACE(*tmps)) + tmps++, len--; if (*tmps == '0') - tmps++; + tmps++, len--; argtype = 1; /* allow underscores */ if (*tmps == 'x') - value = scan_hex(++tmps, 99, &argtype); + value = scan_hex(++tmps, --len, &argtype); else if (*tmps == 'b') - value = scan_bin(++tmps, 99, &argtype); + value = scan_bin(++tmps, --len, &argtype); else - value = scan_oct(tmps, 99, &argtype); + value = scan_oct(tmps, len, &argtype); XPUSHn(value); RETURN; } diff --git a/t/op/oct.t b/t/op/oct.t index 896f8756b6..fe155d3a2d 100755 --- a/t/op/oct.t +++ b/t/op/oct.t @@ -1,6 +1,6 @@ #!./perl -print "1..44\n"; +print "1..50\n"; print +(oct('0b1_0101') == 0b101_01) ? "ok" : "not ok", " 1\n"; print +(oct('0b10_101') == 0_2_5) ? "ok" : "not ok", " 2\n"; @@ -77,3 +77,12 @@ if (ord("\t") != 9) { else { print "\x2F_" eq "/_" ? "ok" : "not ok", " 44\n"; } + +print +(oct('0b'.( '0'x10).'1_0101') == 0b101_01) ? "ok" : "not ok", " 45\n"; +print +(oct('0b'.( '0'x100).'1_0101') == 0b101_01) ? "ok" : "not ok", " 46\n"; +print +(oct('0b'.('0'x1000).'1_0101') == 0b101_01) ? "ok" : "not ok", " 47\n"; + +print +(hex(( '0'x10).'01234') == 0x1234) ? "ok" : "not ok", " 48\n"; +print +(hex(( '0'x100).'01234') == 0x1234) ? "ok" : "not ok", " 49\n"; +print +(hex(('0'x1000).'01234') == 0x1234) ? "ok" : "not ok", " 50\n"; + diff --git a/t/op/pwent.t b/t/op/pwent.t index 4cccbfe016..d811f06a33 100755 --- a/t/op/pwent.t +++ b/t/op/pwent.t @@ -73,7 +73,12 @@ while (<PW>) { chomp; # LIMIT -1 so that users with empty shells don't fall off my @s = split /:/, $_, -1; - my ($name_s, $passwd_s, $uid_s, $gid_s, $gcos_s, $home_s, $shell_s) = @s; + my ($name_s, $passwd_s, $uid_s, $gid_s, $gcos_s, $home_s, $shell_s); + if ($^O eq 'darwin') { + ($name_s, $passwd_s, $uid_s, $gid_s, $gcos_s, $home_s, $shell_s) = @s[0,1,2,3,7,8,9]; + } else { + ($name_s, $passwd_s, $uid_s, $gid_s, $gcos_s, $home_s, $shell_s) = @s; + } next if /^\+/; # ignore NIS includes if (@s) { push @{ $seen{$name_s} }, $.; @@ -88,7 +93,7 @@ while (<PW>) { } # In principle we could whine if @s != 7 but do we know enough # of passwd file formats everywhere? - if (@s == 7) { + if (@s == 7 || ($^O eq 'darwin' && @s == 10)) { @n = getpwuid($uid_s); # 'nobody' et al. next unless @n; |