develooper Front page | perl.perl5.porters | Postings from January 2001

[ID 20010131.001] Class::Struct autogenerated 'new' method causesinfinite loop

From:
train1
Date:
January 31, 2001 01:02
Subject:
[ID 20010131.001] Class::Struct autogenerated 'new' method causesinfinite loop
Message ID:
200101310901.JAA02654@cwtrn112.morgan.com
This is a bug report for perl from mjd@plover.com,
generated with the help of perlbug 1.20 running under perl 5.00404.


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

Consider the following sample program:

	package Person;
	use Class::Struct;
 
	struct Person => 
	  {
	   name => '$',
	   spouse => 'Person',
	  };

	package main;
	
	my $z = Person->new;

The 'new' method generated here is:

        sub new {
          my($r) = {};
          $r->{'name'} = undef;
          $r->{'spouse'} = 'Person'->new();
          bless $r;
        }

so that the Person::new function calls itself in an infinite recursion.

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

---
Site configuration information for perl 5.00404:

Configured by wpm at Wed Nov 26 16:55:08 EST 1997.

Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
  Platform:
    osname=solaris, osvers=2.5.1, archname=sun4-solaris
    uname='sunos zappa 5.5.1 generic_103640-12-1 sun4u sparc sunw,ultra-1 '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio=undef d_sfio=undef
  Compiler:
    cc='/ms/dist/fsf/PROJ/gcc/2.7.2.0/bin/gcc', optimize='-O', gccversion=2.7.2
    cppflags='-DDEBUGGING_MSTATS -DPERL_EMERGENCY_SBRK -DPACK_MALLOC -DTWO_POT_OPTIMIZE -I/ms/dist/aurora/include -I/ms/dist/fsf/include'
    ccflags ='-DDEBUGGING_MSTATS -DPERL_EMERGENCY_SBRK -DPACK_MALLOC -DTWO_POT_OPTIMIZE -I/ms/dist/aurora/include -I/ms/dist/fsf/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='/ms/dist/fsf/PROJ/gcc/2.7.2.0/bin/gcc', ldflags =' -L/ms/dist/aurora/lib -L/ms/dist/fsf/lib'
    libpth=/ms/dist/aurora/lib /ms/dist/fsf/lib /lib /usr/lib /usr/ccs/lib /usr/local/lib
    libs=-lsocket -lnsl -lgdbm -ldb -ldl -lm -lc -lcrypt
    libc=/lib/libc.so, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G -L/ms/dist/aurora/lib -L/ms/dist/fsf/lib'

Locally applied patches:
	

---
@INC for perl 5.00404:
	/ms/dist/perl5/PROJ/core/5.00404-n32/exec/lib/perl5
	/ms/dist/perl5/PROJ/core/5.00404-n32/common/lib/perl5
	/ms/dist/perl5/VERS/5.004/lib/perl5
	/ms/dist/perl5/lib/perl5
	/ms/dist/aurora/lib/perl5
	.

---
Environment for perl 5.00404:
    HOME=/ms/user/t/train1
    LANG=C
    LD_LIBRARY_PATH=/usr/dt/lib:/opt/softbench/lib:/usr/openwin/lib:/ms/dist/aurora/lib
    LOGDIR (unset)
    PATH=/ms/user/t/train1/bin:/ms/dist/aurora/hackbin:/ms/dist/aurora/bin:/bin:/usr/ccs/bin:/usr/ucb:/ms/dist/fsf/bin:/ms/dist/afs/bin:/ms/dist/aurora/sbin:/usr/sbin:/ms/dist/afs/sbin:.:/usr/dt/bin:/usr/openwin/bin
    PERL_BADLANG (unset)
    SHELL=/bin/ksh




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About