Closed p5pRT closed 20 years ago
[Please enter your report here]
I'm getting the following error running make test on bleadperl:
michaels@orbit:\~/perl-current> ./perl -Ilib t/lib/b-stash.t Can't declare another package's variables at t/lib/b-stash.t line 42 BEGIN failed--compilation aborted at t/lib/b-stash.t line 42.
The version info is:
Summary of my perl5 (revision 5.0 version 7 subversion 1) configuration: Platform: osname=linux\, osvers=2.4.4\, archname=i686-linux uname='linux orbit.iii.co.uk 2.4.4 #1 mon apr 30 14:23:17 bst 2001 i686 unknown ' config_args='-des -Dusedevel' hint=recommended\, useposix=true\, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef Compiler: cc='cc'\, ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'\, optimize='-O2'\, cppflags='-fno-strict-aliasing -I/usr/local/include' ccversion=''\, gccversion='2.95.2 20000220 (Debian GNU/Linux)'\, 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\, usemymalloc=n\, prototype=define Linker and Libraries: ld='cc'\, ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lndbm -ldb -ldl -lm -lc -lposix -lcrypt -lutil perllibs=-lnsl -ldl -lm -lc -lposix -lcrypt -lutil libc=/lib/libc-2.1.3.so\, so=so\, useshrplib=false\, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs\, dlext=so\, d_dlsymun=undef\, ccdlflags='-rdynamic' cccdlflags='-fpic'\, lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Locally applied patches: DEVEL10155 Built under linux Compiled at May 21 2001 11:19:00 @INC: lib /usr/local/lib/perl5/5.7.1/i686-linux /usr/local/lib/perl5/5.7.1 /usr/local/lib/perl5/site_perl/5.7.1/i686-linux /usr/local/lib/perl5/site_perl/5.7.1 /usr/local/lib/perl5/site_perl/5.6.1/i686-linux /usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl/5.6.0/i686-linux /usr/local/lib/perl5/site_perl/5.6.0 /usr/local/lib/perl5/site_perl .
Michael
If this is the line...
42 if (($Config{static_ext} eq ' ' || 43 ($Config{static_ext} eq 'Socket' && $Is_VMS)) 44 && !($^O eq 'os2' and $OS2::is_aout) 45 ) {
Then its probably tripping over the $OS2::is_aout. I don't have a copy of bleadperl compiled at the moment\, working on it. Interestingly enough\, that error message comes from vars.pm.
Line 42 in my copy is:
use vars qw($OS2::is_aout);
Michael
Well\, that's the problem. Seems to have already been fixed\, though. Grab the next patch and give a yell.
Just rsynced again\, no change.
.patch says 10172\, patchlevel.h says DEVEL10155.
What patch do we think fixed it?
Michael
The one that exists only in my small\, happy little world.
Seems that 'use vars' was plopped in to shut up a warning. Hmmm... where does that magic little $OS2::is_aout spring from anyway?
Here's a quick little patch to clear up the error\, but I'd still like to know where that variable comes from. README.os2 lists some "prebuilt" variables that look like they should go into %Configure or a real OS2.pm instead. ETOOMAGICAL.
--- t/lib/b-stash.t 2001/05/21 11:33:31 1.1 +++ t/lib/b-stash.t 2001/05/21 11:39:08 @@ -17\,7 +17\,7 @@
sub ok { print "ok $test\n"; $test++ }
- +() = $OS2::is_aout; # shut up a 'variable used only once' warning my $a; my $Is_VMS = $^O eq 'VMS'; my $Is_MacOS = $^O eq 'MacOS'; @@ -39\,7 +39\,6 @@ $a =~ s/-uVMS\,-uVMS::Filespec\,//; $a =~ s/-uSocket\,//; # Socket is optional/compiler version dependent } -use vars qw($OS2::is_aout); if (($Config{static_ext} eq ' ' || ($Config{static_ext} eq 'Socket' && $Is_VMS)) && !($^O eq 'os2' and $OS2::is_aout)
Already fixed in my little copy (not yet synced back to the repository\, though...)
And also\, any such "prebuilt" variables should be flagged as "already seen" so that you don't get "used once" errors\, as already happens for\, e.g. %ENV.
Mike Guy
Yeah\, $Config{OS2_xxx} would be nicer.
a real OS2.pm instead. ETOOMAGICAL.
And also\, any such "prebuilt" variables should be flagged as "already seen" so that you don't get "used once" errors\, as already happens for\, e.g. %ENV.
Mike Guy
This is what OS/2 port is doing. Do you want this to be done with $OS2::is_omf on other platforms too? ;-)
Hmm\, an interesting solution may be to have it in $^O{is_aout} etc.\, and mark %^O as used-already everywhere...
Ilya
It has long been a pet hate of mine that one has to write circumlocutions like
{ package DB; use vars '$single' };
in order to avoid "used once" warnings. And the restriction in vars.pm is entirely undocumented.
So here's a patch (for bleadperl) to vars.pm to support qualified variables. And also a test suite for vars.pm since there wasn't one.
And before people start shouting "But 'use vars' is obsolete"\, note that this case is not supported by "our"\, and Larry has decreed that it never will be.
Mike Guy
I have mixed feelings on this. Using other variable's packages is bad\, and I'd like it to remain relatively difficult to do so. However\, explicitly declaring that you're going to use someone else's variable is better than just nabbing the thing directly. And yes\, the tricks necessary to get around the "used only once" warnings are annoying.
How about this. C\< use vars '$OS2::is_aout'; > will only work if that variable has already been declared/used by the other package.
As an alternative/addition\, a seperate pragma. C\< use your '$OS2::is_aout' > I particularly like this as it reduces the scope of vars.pm\, its complexity and what it should do. your.pm can be distributed independently as a CPAN module\, thus the new syntax will be useful before 5.8.0 (something that makes things like our() not yet entirely useful).
And as a brain fart\, perhaps a 'your' keyword? C\< your $OS2::is_aout; >
I supplied a patch for this one year ago. It was not accepted.
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-05/msg00713.html http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-05/msg00745.html
If it hasn't made it to your local mirror\, it can always be gotten from http://www.pobox.com/~schwern/src/your-0.01.tar.gz
Also\, I noticed in the patch you've added a bunch of new tests for vars.pm. Could you tear this out into a seperate patch less the %Foo::bar stuff? I don't want to lose the new test in the noise of figuring out if this new vars.pm feature is in or not.
Argh. No. Please.
It's against DWIM which is so typical Perl.
Let Perl figure out what the programmer wants\, don't let her dance a different dance just because you are referring to someone elses package.
The "It doesn't stroke with my programming style\, so it should be forbidden/hard to do" reasoning should die.
Abigail
Absolutely
Graham.
Surely it should be their.pm ? only 1/2 ;-)
Also\, I noticed in the patch you've added a bunch of new tests for vars.pm. Could you tear this out into a seperate patch less the %Foo::bar stuff? I don't want to lose the new test in the noise of figuring out if this new vars.pm feature is in or not.
To clarify: that patch was to upgrade "our". And as I noted in my message\, Larry has specifically rejected that. But AFAIK no patch for "use vars" has been submitted previously. Everyone posting in the referenced thread seemed to be in favour of changing "use vars". I didn't see any objection.
To repeat what I said - the fact that "our" is not to be upgraded strengthens the case for upgrading "use vars".
Mike Guy
Migrated from rt.perl.org#7019 (status was 'resolved')
Searchable as RT7019$