Smoke [5.9.0] 25361 FAIL(m) openbsd 3.6 (i386/1 cpu)
Automated smoke report for 5.9.0 patch 25361 accognoscere.homeunix.org: AMD Athlon(TM) XP 1800+ (AuthenticAMD 686-class) (i386/1 cpu) onopenbsd - 3.6 using cc version 2.95.3 20010125 (prerelease, propolice) smoketime 3 minutes 2 seconds (average 22.750 seconds) Summary: FAIL(m) O = OK F = Failure(s), extended report at the bottom X = Failure(s) under TEST but not under harness ? = still running or test results not (yet) available Build failures during: - = unknown or N/A c = Configure, m = make, M = make (after miniperl), t = make test-prep 25361 Configuration (common) none --- - m - m - m - m - -Duse64bitint m - m - -Duseithreads m - m - -Duseithreads -Duse64bitint | | | +- PERLIO = perlio -DDEBUGGING | | +--- PERLIO = stdio -DDEBUGGING | +- PERLIO = perlio +--- PERLIO = stdio -- Report by Test::Smoke v1.19#716 running on perl 5.8.5 (Reporter v0.016 / Smoker v0.015)
[perl #37094] Internal warning from exception inside a grep
# New Ticket Created by Chris Heath # Please include the string: [perl #37094] # in the subject line of all future correspondence about this issue. # URL: https://rt.perl.org/rt3/Ticket/Display.html?id=37094 This is a bug report for perl from [EMAIL PROTECTED], generated with the help of perlbug 1.35 running under perl v5.8.6. - Throwing an exception inside a grep sometimes causes Perl to emit an internal warning. $ perl -e 'for (foo) { grep(die, bar) }' Died at -e line 1. Attempt to free unreferenced scalar: SV 0x96c61dc, Perl interpreter: 0x96ae008. Does this warning indicate possible internal corruption? I have seen some Perl corruption in a production system at my work recently, as well as this warning, so I wondered if they could be related. [Please do not change anything below this line] - --- Flags: category=core severity=low --- This perlbug was built using Perl v5.8.6 in the Red Hat build system. It is being executed now by Perl v5.8.6 - Wed May 18 18:20:12 EDT 2005. Site configuration information for perl v5.8.6: Configured by Red Hat, Inc. at Wed May 18 18:20:12 EDT 2005. Summary of my perl5 (revision 5 version 8 subversion 6) configuration: Platform: osname=linux, osvers=2.4.21-27.0.2.elsmp, archname=i386-linux-thread-multi uname='linux decompose.build.redhat.com 2.4.21-27.0.2.elsmp #1 smp wed jan 12 23:35:44 est 2005 i686 i686 i386 gnulinux ' config_args='-des -Doptimize=-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -Dversion=5.8.6 -Dmyhostname=localhost [EMAIL PROTECTED] -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_endprotoent_r_proto -Ud_endservent_r_proto -Ud_sethostent_r_proto -Ud_setprotoent_r_proto -Ud_setservent_r_proto -Dinc_version_list=5.8.5 5.8.4 5.8.3' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables', cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='4.0.0 20050516 (Red Hat 4.0.0-6)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='gcc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=/lib/libc-2.3.5.so, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.3.5' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.8.6/i386-linux-thread-multi/CORE' cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib' Locally applied patches: --- @INC for perl v5.8.6: /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.6/i386-linux-thread-multi /usr/lib/perl5/5.8.6 . --- Environment for perl v5.8.6: HOME=/home/chris
Re: [perl #37091] File::Path::mkpath resets errno
[EMAIL PROTECTED] (via RT) wrote: When calling File::Path::mkpath and one of the mkdir fails, the functions checks if the directory was not created by other process. The problem is the check resets $! and so there is no way how the caller may find out the reason ($@ contains only locale specific message). The solution is attached bellow. Thanks, applied to the development sources of perl as change #25362.
Smoke [5.9.3] 25361 FAIL(F) bsd/os 4.1 (i386/1 cpu)
Automated smoke report for 5.9.3 patch 25361 fixit.xs4all.nl: Pentium II (i386/1 cpu) onbsd/os - 4.1 using cc version egcs-2.91.66 19990314 (egcs-1.1.2 release) smoketime 3 hours 56 minutes (average 1 hour 58 minutes) Summary: FAIL(F) O = OK F = Failure(s), extended report at the bottom X = Failure(s) under TEST but not under harness ? = still running or test results not (yet) available Build failures during: - = unknown or N/A c = Configure, m = make, M = make (after miniperl), t = make test-prep 25361 Configuration (common) none --- - F F - - -Duse64bitint O F - - | | | +- PERLIO = perlio -DDEBUGGING | | +--- PERLIO = stdio -DDEBUGGING | +- PERLIO = perlio +--- PERLIO = stdio Failures: (common-args) none [stdio/perlio] -Duse64bitint ../t/op/int.t...FAILED 11 [perlio] ../lib/Net/hostent.tFAILED 4-7 -- Report by Test::Smoke v1.19_67 build 842 running on perl 5.00503 (Reporter v0.019 / Smoker v0.023)
Re: better assertion support
On Tue, Jun 14, 2005 at 11:25:08AM +0200, Rafael Garcia-Suarez wrote: I'm sure you'd welcome feedback from the porters on this feature, too. Is there a list of the patches to blead, from which one can create a cumulative patch representing the changes needed to add assertions. Now that the assertion code is (I believe) fully feature complete, I'm wondering if it can be refactored into a minimal set of core hooks, and an XS module in ext. Having more hooks increases what is possible for future authors to achieve as independent modules released to CPAN. Nicholas Clark
Re: [perl #37094] Internal warning from exception inside a grep
On Tue, Sep 06, 2005 at 07:01:06PM -0700, Chris Heath wrote: Throwing an exception inside a grep sometimes causes Perl to emit an internal warning. $ perl -e 'for (foo) { grep(die, bar) }' Died at -e line 1. Attempt to free unreferenced scalar: SV 0x96c61dc, Perl interpreter: 0x96ae008. The unreferenced scalar seems to be bar as this will still generate an error $ perl -e 'grep {die} bar for undef' Died at -e line 1. Attempt to free unreferenced scalar: SV 0x800dd0. (undef has special reference counting semantics) Replacing grep with map produces the same error. Does this warning indicate possible internal corruption? I have seen some Perl corruption in a production system at my work recently, as well as this warning, so I wondered if they could be related. Well, it's a double free, in as much as one part of the interpreter has a pointer to a block of memory that will be recycled as a new scalar at some point. I'm not sure quite what route, or what manipulation of $@ could create actual corruption though. Nicholas Clark
how to specify namespace in perlxs
Hi all, Does any one know why I can't add 'using namespace brabra;' in .xs file? The xsubpp can't recognize while generating the .c file. -- Bst Rgrs, Dongxu
Re: better assertion support
Hi, Nicholas Clark wrote: Is there a list of the patches to blead, from which one can create a cumulative patch representing the changes needed to add assertions. There were not too many. Greeping for assertions on the Changes files seems to show them all: 18727, 18735, 18739, 18750, 18827, 18828, 19808. Now that the assertion code is (I believe) fully feature complete, I'm wondering if it can be refactored into a minimal set of core hooks, and an XS module in ext. Having more hooks increases what is possible for future authors to achieve as independent modules released to CPAN. There were two mayor reasons why assertions could not be implemented outside the core: 1) assertion magic happens at compile time changing the way assertion calls are compiled inside their callers. Extending perl to allow customizing how subroutine calls are compiled, well, that makes me thing about macros, but adding support for macros to perl5 seems a bit crazy to me :-) ...though some kind of low level macros able to work with OPs could be used, for instance: sub sqr : macro { return B::OPBIN-new(mul, $_[0], $_[0]-clone); } 2) subs and attributes: currently, subs attributes are very poorly handled, there are very few things one can do with them, specially because there is no information about the GLOBs where the subs are going to be stored. Attribute::Handlers tries to work around that, but it is far from perfect, mostly because it runs at INIT or CHECK time, and so too late for attributes that want to influence compile time! I think this could be done better, maybe adding support for a new MODIFY_CODEGLOB_ATTRIBUTES hook. Or maybe two, one called before the sub is defined and another after (MODIFY_PRECODEGLOB_ATTRIBUTES, MODIFY_POSTCODEGLOB_ATTRIBUTES), but well, it's a complex matter and all the different possible cases should be considered. Cheers, - Salvador.
exempli gratia is e.g.
Porters, Following on from Steve Peters' id est is i.e. peeve: http://www.mail-archive.com/perl5-porters@perl.org/msg89902.html I was struck by one of my own: exempli gratia being abbreviated to eg or eg., rather than e.g. Before sending off an unappliable patch, I was wondering what was the best way to go about this. The number of files is large, and concerns only modules, some (all?) of which are dual-lifed on CPAN. What's the best way forward? % find . -name '*.pm' \ | xargs perl -nle 'print $ARGV if /(?!\/)\beg\b/' \ | uniq ./ext/Data/Dumper/Dumper.pm ./ext/Fcntl/Fcntl.pm ./ext/IO/lib/IO/Socket/UNIX.pm ./ext/IO/lib/IO/Handle.pm ./ext/IO/lib/IO/Seekable.pm ./ext/List/Util/lib/Scalar/Util.pm ./ext/threads/shared/shared.pm ./lib/ExtUtils/Constant/Base.pm ./lib/ExtUtils/MakeMaker.pm ./lib/ExtUtils/MM_NW5.pm ./lib/ExtUtils/MM_Unix.pm ./lib/ExtUtils/MM_VMS.pm ./lib/ExtUtils/MM_Win32.pm ./lib/File/Copy.pm ./lib/File/Temp.pm ./lib/I18N/LangTags/List.pm ./lib/Locale/Country.pm ./lib/Locale/Script.pm ./lib/Net/Config.pm ./lib/Pod/Find.pm ./lib/Pod/Html.pm ./lib/Pod/LaTeX.pm ./lib/CPAN.pm ./lib/IO/Socket/UNIX.pm ./lib/IO/Handle.pm ./lib/IO/Seekable.pm ./lib/Data/Dumper.pm ./lib/Fcntl.pm ./lib/Scalar/Util.pm Thanks, David
Re: exempli gratia is e.g.
On Wed, 07 Sep 2005 18:13:22 +0200, David Landgren [EMAIL PROTECTED] wrote: Porters, Following on from Steve Peters' id est is i.e. peeve: http://www.mail-archive.com/perl5-porters@perl.org/msg89902.html I was struck by one of my own: exempli gratia being abbreviated to eg or eg., rather than e.g. Before sending off an unappliable patch, I was wondering what was the best way to go about this. The number of files is large, and concerns only modules, some (all?) of which are dual-lifed on CPAN. What's the best way forward? One big hunk will do. I have a script that automatically generates the list of authors to be Cc'd A small problem is that these changes are so small that they do not update the version number of the modules. % find . -name '*.pm' \ | xargs perl -nle 'print $ARGV if /(?!\/)\beg\b/' \ | uniq ./ext/Data/Dumper/Dumper.pm ./ext/Fcntl/Fcntl.pm ./ext/IO/lib/IO/Socket/UNIX.pm ./ext/IO/lib/IO/Handle.pm ./ext/IO/lib/IO/Seekable.pm ./ext/List/Util/lib/Scalar/Util.pm ./ext/threads/shared/shared.pm ./lib/ExtUtils/Constant/Base.pm ./lib/ExtUtils/MakeMaker.pm ./lib/ExtUtils/MM_NW5.pm ./lib/ExtUtils/MM_Unix.pm ./lib/ExtUtils/MM_VMS.pm ./lib/ExtUtils/MM_Win32.pm ./lib/File/Copy.pm ./lib/File/Temp.pm ./lib/I18N/LangTags/List.pm ./lib/Locale/Country.pm ./lib/Locale/Script.pm ./lib/Net/Config.pm ./lib/Pod/Find.pm ./lib/Pod/Html.pm ./lib/Pod/LaTeX.pm ./lib/CPAN.pm ./lib/IO/Socket/UNIX.pm ./lib/IO/Handle.pm ./lib/IO/Seekable.pm ./lib/Data/Dumper.pm ./lib/Fcntl.pm ./lib/Scalar/Util.pm Thanks, David -- H.Merijn BrandAmsterdam Perl Mongers (http://amsterdam.pm.org/) using Perl 5.6.2, 5.8.0, 5.8.5, 5.9.2 on HP-UX 10.20, 11.00 11.11, AIX 4.3 5.2, SuSE 9.2 9.3, and Cygwin. http://www.cmve.net/~merijn Smoking perl: http://www.test-smoke.org,perl QA: http://qa.perl.org reports to: [EMAIL PROTECTED],perl-qa@perl.org
Re: [perl #37094] Internal warning from exception inside a grep
Nicholas Clark wrote: On Tue, Sep 06, 2005 at 07:01:06PM -0700, Chris Heath wrote: Throwing an exception inside a grep sometimes causes Perl to emit an internal warning. $ perl -e 'for (foo) { grep(die, bar) }' Died at -e line 1. Attempt to free unreferenced scalar: SV 0x96c61dc, Perl interpreter: 0x96ae008. The unreferenced scalar seems to be bar as this will still generate an error $ perl -e 'grep {die} bar for undef' Died at -e line 1. Attempt to free unreferenced scalar: SV 0x800dd0. (undef has special reference counting semantics) Replacing grep with map produces the same error. Does this warning indicate possible internal corruption? I have seen some Perl corruption in a production system at my work recently, as well as this warning, so I wondered if they could be related. Well, it's a double free, in as much as one part of the interpreter has a pointer to a block of memory that will be recycled as a new scalar at some point. I'm not sure quite what route, or what manipulation of $@ could create actual corruption though. This bug is a dup of #24254, sometime ago I was able to trace it and to found its cause, not to solve it :-( Attached to that bug report is a description of what is going on. Cheers, - Salvador.
Re: how to specify namespace in perlxs
Dongxu Ma wrote: Does any one know why I can't add 'using namespace brabra;' in .xs file? The xsubpp can't recognize while generating the .c file. Because use namespace brabra; is a Perl pragma, not C/XS. What are you trying to do? John -- John Peacock Director of Information Research and Technology Rowman Littlefield Publishing Group 4501 Forbes Boulevard Suite H Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5748
Re: exempli gratia is e.g.
Following on from Steve Peters' id est is i.e. peeve: http://www.mail-archive.com/perl5-porters@perl.org/msg89902.html I was struck by one of my own: exempli gratia being abbreviated to eg or eg., rather than e.g. I would like to suggest that Latin is obscure, and latin abbreviations are doubly obscure. There is no space constraint that should require us to use e.g. in place of for example. Using i.e. in place of that is is even sillier. (57% sillier, in fact.) If you're going to do the work of locating these locutions, can I suggest that you get rid of the unnecessary abbreviations entirely?
Re: exempli gratia is e.g.
On 9/7/05, Mark Jason Dominus [EMAIL PROTECTED] wrote: I would like to suggest that Latin is obscure, and latin abbreviations are doubly obscure. There is no space constraint that should require us to use e.g. in place of for example. Using i.e. in place of that is is even sillier. (57% sillier, in fact.) How do you get that result ? I'm closer to 63.63%.
Re: exempli gratia is e.g.
Rafael Garcia-Suarez: On 9/7/05, Mark Jason Dominus [EMAIL PROTECTED] wrote: I would like to suggest that Latin is obscure, and latin abbreviations are doubly obscure. There is no space constraint that should require us to use e.g. in place of for example. Using i.e. in place of that is is even sillier. (57% sillier, in fact.) How do you get that result ? I'm closer to 63.63%. Using e.g. instead of for example saves 7 characters, which is silly. Using i.e. instead of that is saves only 3 characters, which is 57% fewer. But probably I should have said that since the savings is only 3/7 as great, the silliness is 7/3 as much, or 133% more, not 57%. I do not use these abbreviations in my own writing, and I see no harm in avoiding them. They do not add any expressiveness to the language.
Re: RFC - eliminate discrete arenaroots, mentoring
On Tue, Sep 06, 2005 at 11:40:12AM -0600, Jim Cromie wrote: t/op/sprintf..FAILED at test 239 This makes little sense to me. The output is not ok 239 %*2$1d [12, 3] %*2$1d INVALID 12 Translated, that seems to mean that given the template %*2$1d and the data [12, 3] we were expecting to see %*2$1d INVALID (where INVALID means that an /^Invalid conversion/ warning was issued) but actually we got the result 12 But your patch goes nowhere near the printf code. Nicholas Clark
Re: RFC - eliminate discrete arenaroots, mentoring
Scrub my previous message. It was incorrect. On Tue, Sep 06, 2005 at 11:40:12AM -0600, Jim Cromie wrote: t/op/sprintf..FAILED at test 239 @@ -9101,11 +9166,9 @@ } if (!asterisk) - { if( *q == '0' ) fill = *q++; EXPECT_NUMBER(q, width); - } if (vectorize) { if (vectorarg) { You didn't want to do that. :-) Nicholas Clark
Re: RFC - eliminate discrete arenaroots, mentoring
@@ -9101,11 +9166,9 @@ } if (!asterisk) - { FWIW here's a one-liner that finds ifs with opening brackets on following lines in case anyone wants to play with style patching. perl -e 'undef $/; while (@ARGV){ print $ARGV[0]\n;$slurp = ;\ @ifb = $slurp =~ /(^[ \t]*if\s*\(.+?\)\s+\{)/gm;\ print join \n---\n, grep {/\n/} @ifb }' *.c */*.c | less
[EMAIL PROTECTED] VMS fixes for cbuilder
This patch is needed for the lib/ExtUtils/ParseXS.t/basic.t test to pass on VMS. In lib/ExtUtils/CBuilder/Platform/VMS.pm, VMS needs to have a pre-link file generated. In lib/ExtUtils/CBuilder/Base.pm: VMS can only have one /include qualifier on the CC command, and the last one wins, so if one is present in @ccflags, remove it. VMS needs to have the executable named the same way that dynaloader will look for it. VMS needs to have two option files specified in the link, one to indicate the exported symbols, and one to locate the PERLSHR image. -John [EMAIL PROTECTED] Personal Opinion Only --- lib/ExtUtils/CBuilder/Base.pm_0_13 Wed Aug 24 21:11:02 2005 +++ lib/ExtUtils/CBuilder/Base.pm Wed Sep 7 19:23:45 2005 @@ -89,6 +89,13 @@ my @extra_compiler_flags = $self-split_like_shell($args{extra_compiler_flags}); my @cccdlflags = $self-split_like_shell($cf-{cccdlflags}); my @ccflags = $self-split_like_shell($cf-{ccflags}); + + #VMS can only have one include list, remove the one from config. + if ((@include_dirs != 0) ($^O eq 'VMS')) { +for (@ccflags) { + s/\/Include[^\/]*//; +} + } my @optimize = $self-split_like_shell($cf-{optimize}); my @flags = (@include_dirs, @cccdlflags, @extra_compiler_flags, $self-arg_nolink, @@ -186,6 +193,15 @@ $objects = [$objects] unless ref $objects; my $out = $args{$type} || $self-$type($objects-[0]); + # Need to create with the same name as Dyanloader will load with. + if ($^O eq 'VMS') { +my ($dev,$dir,$file) = File::Spec-splitpath($out); +if (defined DynaLoader::mod2fname) { + $file = DynaLoader::mod2fname([$file]); + $out = File::Spec-catpath($dev,$dir,$file); +} + } + my @temp_files; @temp_files = $self-prelink(%args, @@ -195,6 +211,14 @@ my @output = $args{lddl} ? $self-arg_share_object_file($out) : $self-arg_exec_file($out); my @shrp = $self-split_like_shell($cf-{shrpenv}); my @ld = $self-split_like_shell($cf-{ld}); + + # vms has two option files, the external symbol, and to pull in PerlShr + if ($^O eq 'VMS') { +$objects-[0] .= ','; +$objects-[1] = 'sys$disk:[]' . @temp_files[0] . '/opt,'; +$objects-[2] = $self-perl_inc() . 'PerlShr.Opt/opt'; + } + $self-do_system(@shrp, @ld, @output, @$objects, @linker_flags) or die error building $out from @$objects; --- lib/ExtUtils/CBuilder/Platform/VMS.pm_0_13 Wed Aug 24 21:11:02 2005 +++ lib/ExtUtils/CBuilder/Platform/VMS.pm Wed Sep 7 19:26:46 2005 @@ -7,7 +7,7 @@ $VERSION = '0.12'; @ISA = qw(ExtUtils::CBuilder::Base); -sub need_prelink { 0 } +sub need_prelink { 1 } sub arg_include_dirs { my $self = shift;
[PATCH blead] Make t/op/local.t use test.pl.
I wanted to add some tests to the middle of t/op/local.t but saw I'd have to renumber everything. Patch 1 changes it to use test.pl so numbering doesn't matter. Patch 2 moves some tests where they belong. My tests are forthcoming. -- Rick Delaney [EMAIL PROTECTED] diff -pruN perl-current/t/op/local.t perl-current-dev/t/op/local.t --- perl-current/t/op/local.t 2005-06-22 18:12:59.0 -0400 +++ perl-current-dev/t/op/local.t 2005-09-07 22:33:12.421084579 -0400 @@ -1,55 +1,77 @@ #!./perl -print 1..79\n; +BEGIN { +chdir 't' if -d 't'; +require './test.pl'; +} +plan tests = 79; sub foo { local($a, $b) = @_; local($c, $d); -$c = ok 3\n; -$d = ok 4\n; -{ local($a,$c) = (ok 9\n, ok 10\n); ($x, $y) = ($a, $c); } -print $a, $b; -$c . $d; -} - -$a = ok 5\n; -$b = ok 6\n; -$c = ok 7\n; -$d = ok 8\n; - -print foo(ok 1\n,ok 2\n); - -print $a,$b,$c,$d,$x,$y; +$c = c 3; +$d = d 4; +{ local($a,$c) = (a 9, c 10); ($x, $y) = ($a, $c); } +is($a, a 1); +is($b, b 2); +$c, $d; +} + +$a = a 5; +$b = b 6; +$c = c 7; +$d = d 8; + +my @res; [EMAIL PROTECTED] = foo(a 1,b 2); +is($res[0], c 3); +is($res[1], d 4); + +is($a, a 5); +is($b, b 6); +is($c, c 7); +is($d, d 8); +is($x, a 9); +is($y, c 10); # same thing, only with arrays and associative arrays sub foo2 { local($a, @b) = @_; local(@c, %d); -@c = ok 13\n; -$d{''} = ok 14\n; -{ local($a,@c) = (ok 19\n, ok 20\n); ($x, $y) = ($a, @c); } -print $a, @b; -$c[0] . $d{''}; -} - -$a = ok 15\n; [EMAIL PROTECTED] = ok 16\n; [EMAIL PROTECTED] = ok 17\n; -$d{''} = ok 18\n; - -print foo2(ok 11\n,ok 12\n); +@c = c 3; +$d{''} = d 4; +{ local($a,@c) = (a 19, c 20); ($x, $y) = ($a, @c); } +is($a, a 1); +is(@b, b 2); +$c[0], $d{''}; +} + +$a = a 5; [EMAIL PROTECTED] = b 6; [EMAIL PROTECTED] = c 7; +$d{''} = d 8; + [EMAIL PROTECTED] = foo2(a 1,b 2); +is($res[0], c 3); +is($res[1], d 4); + +is($a, a 5); +is(@b, b 6); +is($c[0], c 7); +is($d{''}, d 8); +is($x, a 19); +is($y, c 20); -print $a,@b,@c,%d,$x,$y; eval 'local($$e)'; -print +($@ =~ /Can't localize through a reference/) ? : not , ok 21\n; +like($@, qr/Can't localize through a reference/); eval '$e = []; local(@$e)'; -print +($@ =~ /Can't localize through a reference/) ? : not , ok 22\n; +like($@, qr/Can't localize through a reference/); eval '$e = {}; local(%$e)'; -print +($@ =~ /Can't localize through a reference/) ? : not , ok 23\n; +like($@, qr/Can't localize through a reference/); # Array and hash elements @@ -57,38 +79,38 @@ print +($@ =~ /Can't localize through a { local($a[1]) = 'foo'; local($a[2]) = $a[2]; -print +($a[1] eq 'foo') ? : not , ok 24\n; -print +($a[2] eq 'c') ? : not , ok 25\n; +is($a[1], 'foo'); +is($a[2], 'c'); undef @a; } -print +($a[1] eq 'b') ? : not , ok 26\n; -print +($a[2] eq 'c') ? : not , ok 27\n; -print +(!defined $a[0]) ? : not , ok 28\n; +is($a[1], 'b'); +is($a[2], 'c'); +ok(!defined $a[0]); @a = ('a', 'b', 'c'); { local($a[1]) = X; shift @a; } -print +($a[0].$a[1] eq Xb) ? : not , ok 29\n; +is($a[0].$a[1], Xb); %h = ('a' = 1, 'b' = 2, 'c' = 3); { local($h{'a'}) = 'foo'; local($h{'b'}) = $h{'b'}; -print +($h{'a'} eq 'foo') ? : not , ok 30\n; -print +($h{'b'} == 2) ? : not , ok 31\n; +is($h{'a'}, 'foo'); +is($h{'b'}, 2); local($h{'c'}); delete $h{'c'}; } -print +($h{'a'} == 1) ? : not , ok 32\n; -print +($h{'b'} == 2) ? : not , ok 33\n; -print +($h{'c'} == 3) ? : not , ok 34\n; +is($h{'a'}, 1); +is($h{'b'}, 2); +is($h{'c'}, 3); # check for scope leakage $a = 'outer'; if (1) { local $a = 'inner' } -print +($a eq 'outer') ? : not , ok 35\n; +is($a, 'outer'); # see if localization works when scope unwinds local $m = 5; @@ -98,7 +120,7 @@ eval { die bye; } }; -print $m == 5 ? : not , ok 36\n; +is($m, 5); # see if localization works on tied arrays { @@ -117,13 +139,13 @@ tie @a, 'TA'; { local($a[1]) = 'foo'; local($a[2]) = $a[2]; -print +($a[1] eq 'foo') ? : not , ok 37\n; -print +($a[2] eq 'c') ? : not , ok 38\n; +is($a[1], 'foo'); +is($a[2], 'c'); @a = (); } -print +($a[1] eq 'b') ? : not , ok 39\n; -print +($a[2] eq 'c') ? : not , ok 40\n; -print +(!defined $a[0]) ? : not , ok 41\n; +is($a[1], 'b'); +is($a[2], 'c'); +ok(!defined $a[0]); { package TH; @@ -144,21 +166,21 @@ tie %h, 'TH'; local($h{'b'}) = $h{'b'}; local($h{'y'}); local($h{'z'}) = 33; -print +($h{'a'} eq 'foo') ? : not , ok 42\n; -print +($h{'b'} == 2) ? : not , ok 43\n; +is($h{'a'}, 'foo'); +is($h{'b'}, 2); local($h{'c'}); delete $h{'c'}; } -print +($h{'a'} == 1) ? : not , ok 44\n; -print +($h{'b'} == 2) ? : not , ok 45\n; -print +($h{'c'} == 3) ? : not , ok 46\n; +is($h{'a'}, 1); +is($h{'b'}, 2); +is($h{'c'}, 3); @a = ('a', 'b', 'c'); { local($a[1]) = X;