[ID 20000127.003] File-scope 'my' array is non-empty, but debugger says it's empty

This is a bug report for perl from rmiller@idx.com,
generated with the help of perlbug 1.26 running under perl 5.00503.


-----------------------------------------------------------------
[Please enter your report here]

The following two-line file illustrates the problem:

    my @res = ("A\n");
    print @res;

Running this with "perl -w" or "perl -w -d" produces the expected output
(a line containing the single letter 'A').  But in the perl debugger,
the command
	x @res
given after the first line executes, but before the second start,
erroneously reports
    empty array

[Please do not change anything below this line]
-----------------------------------------------------------------

---
Site configuration information for perl 5.00503:

Configured by root at Mon Aug 30 23:08:56 EDT 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=linux, osvers=2.2.5-22smp, archname=i386-linux
    uname='linux porky.devel.redhat.com 2.2.5-22smp #1 smp wed jun 2 09:11:51 edt 1999 i686 unknown '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
    cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
    stdchar='char', d_stdstdio=undef, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    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 -ldl -lm -lc -lposix -lcrypt
    libc=, 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'

Locally applied patches:
    

---
@INC for perl 5.00503:
    /usr/local/bin/perl
    /home/rmiller/rel/pmake
    /usr/lib/perl5/5.00503/i386-linux
    /usr/lib/perl5/5.00503
    /usr/lib/perl5/site_perl/5.005/i386-linux
    /usr/lib/perl5/site_perl/5.005
    .

---
Environment for perl 5.00503:
    HOME=/home/rmiller
    LANG=en_US
    LANGUAGE (unset)
    LC_ALL=en_US
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/rmiller/bin:.
    PERL5LIB=/usr/local/bin/perl:/home/rmiller/rel/pmake
    PERL_BADLANG (unset)
    SHELL=/bin/bash
0
rmiller
1/27/2000 11:21:43 PM
perl.perl5.porters 48287 articles. 1 followers. Follow

3 Replies
323 Views

Similar Articles

[PageSpeed] 46

Rich Miller writes:
>     my @res = ("A\n");
>     print @res;
> 
> Running this with "perl -w" or "perl -w -d" produces the expected output
> (a line containing the single letter 'A').  But in the perl debugger,
> the command
> 	x @res
> given after the first line executes, but before the second start,
> erroneously reports
>     empty array

More datapoints:

  DB<1> print @res

  DB<2> eval 'print @res'
A

Something fishy...  eval '...' does not see it, but eval q(eval '...') can
see it...

Ilya
0
ilya
1/27/2000 11:31:01 PM
On Thu, Jan 27, 2000 at 06:31:01PM -0500, Ilya Zakharevich wrote:
> Rich Miller writes:
> >     my @res = ("A\n");
> >     print @res;
> > 
> > Running this with "perl -w" or "perl -w -d" produces the expected output
> > (a line containing the single letter 'A').  But in the perl debugger,
> > the command
> > 	x @res
> > given after the first line executes, but before the second start,
> > erroneously reports
> >     empty array
> 
> More datapoints:
> 
>   DB<1> print @res
> 
>   DB<2> eval 'print @res'
> A
> 
> Something fishy...  eval '...' does not see it, but eval q(eval '...') can
> see it...
> 

This is probably the problem:

[...]/lib/perl5/5.00503> grep \@res perl5db.pl
    my @res;
        @res = eval "$usercontext $evalarg;\n"; # '\n' for nice recursive
    debug
        dumpit($OUT, \@res);
    @res;


Ronald
0
rjk
1/27/2000 11:37:49 PM
On Thu, Jan 27, 2000 at 06:37:49PM -0500, Ronald J Kimball wrote:
> >   DB<1> print @res
> > 
> >   DB<2> eval 'print @res'
> > A
> > 
> > Something fishy...  eval '...' does not see it, but eval q(eval '...') can
> > see it...
> > 
> 
> This is probably the problem:
> 
> [...]/lib/perl5/5.00503> grep \@res perl5db.pl
>     my @res;
>         @res = eval "$usercontext $evalarg;\n"; # '\n' for nice recursive
>     debug
>         dumpit($OUT, \@res);
>     @res;

Thanks!!!  I was going to go mad...

--- ./lib/perl5db.pl~	Tue Nov 30 22:47:10 1999
+++ ./lib/perl5db.pl	Thu Jan 27 18:55:55 2000
@@ -1254,11 +1254,11 @@ sub save {
 # The following takes its argument via $evalarg to preserve current @_
 
 sub eval {
-    my @res;
+    local @res;			# 'my' would make it visible from user code
     {
-	my $otrace = $trace;
-	my $osingle = $single;
-	my $od = $^D;
+	local $otrace = $trace;
+	local $osingle = $single;
+	local $od = $^D;
 	@res = eval "$usercontext $evalarg;\n"; # '\n' for nice recursive debug
 	$trace = $otrace;
 	$single = $osingle;

Enjoy,
Ilya
0
ilya
1/27/2000 11:57:28 PM
Reply:

Similar Artilces:

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

'''''
Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

'do' won't 'do' if '/'
Greetings to All from Au, Have a NetWare Perl 5.8.4 and wanted to tweak File\Spec\NW.pm to try and standardise on '/' separators. If I run a test script (t/uni/lower.t) with an unmodified NW.pm, it calls t/uni/case.pl, that, in case.pl, (when the path separators are '\'), the $file is '..\lib\unicore\To\Lower.pl' and the following code portion works, with $simple getting a returned table: sub casetest { my ($base, $spec, $func) = @_; my $file = File::Spec->catfile(File::Spec->catdir(File::Spec->updir, "lib", &qu...

'''
Name: L Lachowsky Email: e2brutus_10atyahoodotcom Product: Firefox Summary: ''' Comments: why duddn this surprise me... I change default server from IE to Mozilla, and then i get error messages. well, shud I decide to not get on my computer with Mozilla..or shud I risk security breeches with IE....hmmm at least i can get on the internet with IE Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this fee...

Cast from type ''''DBNull'''' to type ''''String'''' is not valid.
How do I avoid getting this error: Cast from type ''''DBNull'''' to type ''''String'''' is not valid. I am trying to get values from the database into a form for updating using a Datareader, SQL is set to allow nulls for certain fields as they are not required but the only way I can get the form to display is by adding a space in SQL. Is there another way around this? Check if it is equal to DBNull.Value first and if it is, don't do the cast.Stanley Tan theSpoke Blog Where in the code does it need to go? I am using the following and it's the profile that isn't always requi...

table_info('','','','%') cannot return any types
I was recently confirming table_info special cases and discovered the case for getting table_types cannot work. table_info('','','','%') should return a list of table types but it returns a list of empty strings instead: my @types = $h->tables('', '', '', '%'); print "all types:\n", join("xxx\n", @types), "\n"; # should output something like: # "dbo" # "INFORMATION_SCHEMA" # "sys" # and actually outputs: xxx xxx It seems to be down to the following ...

It's the fastest ''firefox'' i've ever had!!!:)
Name: Blagovest Email: blago_944atabvdotbg Product: Firefox Summary: It's the fastest ''firefox'' i've ever had!!!:) Comments: I's a great product!I'm really amazed! Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b1) Gecko/20081007 Firefox/3.1b1 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

Send Message to user's Skype' id ,MSN' Id ,Yahoo'sID or Gmail ID.
hi, i m writing a application in which i have to notify the user to his Skype' id ,MSN' Id ,Yahoo'sID or Gmail ID. Please let me know the code usign C#   Thanks Tulika. hi, what do you want to do...i mean....do you wnat to send email's or do you want to send message to the messenger. thanks, rajiv hi i want to send IM messages to online and offline users not Email. Please help me....

Empty 'if'
I've seen several bits of Perl code containing lines such as the following: if ($somevariable) {;} One bit of code even had a comment as follows: if ($somevariable) {;} # for perl -w What is the reasoning behind this? Thanks, Dave From: "Sparrow, Dave" <dave.sparrow@eds.com> > I've seen several bits of Perl code containing lines such as the > following: > > if ($somevariable) {;} > > One bit of code even had a comment as follows: > > if ($somevariable) {;} # for perl -w > > What is the reasoning behind th...

What's the difference between 'Build' and 'Publish'
Greetings....this subject might belong in one of the Visual Studio forums but it's so danged noob-sque.... I'm particularly confused by the 'Precompiled' term in the Publish operation. I'm interested in the path of least resistance between my VS project and my public IIS webserver. thx--steve...  Build means creating the assembly of the project ( .dll or .exe file) wich contains MSIL and a manifest file. When you publish your project u just produce the structure of your folder without producing a .dll file when you want to deploy your Web Project. ...

'IN' Clause or 'OR'
Hello, [1]: select * from TABLEA where COL1 IN('value1','value2''valu3'....) [2]:select * from TABLEA where COL1 = 'value1' OR COL1= 'value2' OR COL1='valu3'. TABLEA is a huge table and it has non-clustered index on COL1. Among the above 2 queries, which query will give me the better performance or fast response and WHY? What is the difference between 'IN' and 'OR' clauses as for as Sybase Optimization is concerned. Which is the better one to be used on huge tables. Thanks. Mac An IN list is treated ...

'or' or 'union'
Hello I was just wondering, in general what is better to use, an 'or' clause in a select or a 'union' to join two selects together. Do both statements create work tables? Many thanks Alex I think OR will be better than union. because suppose u have 3 tables and using OR u can join table a and table b and table c so each table will have only one read. but using union you will join table a and table b and in another query of union u will use table (a or b) and table c so ur one read is more in union . Ramdas Alex Cheung wrote: > Hello > >...

'b'..'a'
Hello. I'm using defferent 5.6.0's for Win32. I wonder wheter following behaviour is intentional or not: d:\>perl -e "print 'b'..'c'" bc d:\>perl -e "print 'b'..'a'" bcdefghijklmnopqrstuvwxyz I expected empty list in latter case, like in perl -e "print 'bb'..'a'" <!ENTITY Vadim REALLIFE "Vadim V.Konovalov, St.Petersburg, Russia"> &Vadim; On Wed, Sep 20, 2000 at 03:14:41PM +0400, Konovalov, Vadim wrote: > Hello. > > I'm using defferent 5.6.0'...

the 'smart folders' inbox and the 'empty trash' action
when 'empty trash' is invoked on the 'smart folders' Inbox, does it empty the trash in *all* of the underlying accounts? /mark Mark T. Kennedy wrote on 2009-12-17 2:13: > when 'empty trash' is invoked on the 'smart folders' Inbox, does it empty the trash in *all* > of the underlying accounts? /mark yes, if you really can see that command in the "smart" mode. -- Regards, LU Wei PGP key ID: 0x92CCE1EA ...

Web resources about - [ID 20000127.003] File-scope 'my' array is non-empty, but debugger says it's empty - perl.perl5.porters

Resources last updated: 1/16/2016 10:02:14 AM