[26994] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 8933 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 8 09:05:57 2006

Date: Wed, 8 Feb 2006 06:05:05 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 8 Feb 2006     Volume: 10 Number: 8933

Today's topics:
    Re: circular references, chdir() and Term::ReadLine::Gn (Jamie)
    Re: circular references, chdir() and Term::ReadLine::Gn (Anno Siegel)
    Re: perl cgi script buffering? <no@email.com>
    Re: problem with XML::Parser dying on errors... <tadmc@augustmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 08 Feb 2006 05:16:25 GMT
From: nospam@geniegate.com (Jamie)
Subject: Re: circular references, chdir() and Term::ReadLine::Gnu?
Message-Id: <Lucy1139375604101900xb9ab4c@localhost>

In: <Xns9763D4874343Casu1cornelledu@127.0.0.1>, "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote:
>Please post a short but complete program that still exhibits the problem 
>you are experiencing.
>
>I am not trying to be difficult ... I cannot imagine where one would 
>even begin to diagnose such an issue without a program that demonstrates 
>the problem.

Thanks, I would have, but I didn't even know where to begin looking 

Was hoping (at the time) someone else had something like that happen and they
could share how they solved it.

The underlying problem is a rats-nest of circular references and an inability
to compile anything that'll "weaken" the reference. 

I tried Scalar::Util but it needed List::Util, which, won't compile on this
system. (it's perl 5.6.0, really old.. I'd like this to work on older versions
of perl if at all possible)

Jamie
-- 
http://www.geniegate.com                    Custom web programming
guhzo_42@lnubb.pbz (rot13)                User Management Solutions


------------------------------

Date: 8 Feb 2006 12:11:23 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: circular references, chdir() and Term::ReadLine::Gnu?
Message-Id: <dscn5b$nra$1@mamenchi.zrz.TU-Berlin.DE>

Jamie <nospam@geniegate.com> wrote in comp.lang.perl.misc:
> In: <20060207205312.617$ef@newsreader.com>, xhoster@gmail.com wrote:
> >Are using the built-in chdir, or File::chdir?
> 
> Built in chdir() 
> 
> Just found problem though..
> 
> >I can't reproduce this.  Can you produce a minimal program which shows this
> >effect?
> 
> During the cleanup, one of the packages was attempting to flush it's
> output to a file that didn't exist anymore (due to the new directory)
> 
> It died, which threw off all the other cleanup code that was there
> to remove the circular references. (There were soo many DESTROY at ...
> debug messages I'd completely missed the one that said it couldn't
> open the file)
> 
> It was buried way deep and I'd forgotten about it.

There is a lesson here.  Destructors must be extremely robust machinery.
They get called in the most awkward situations, for instance after
your program died, or before an object is properly initialized.  They
must check things for defined-ness that can normally be taken for
granted, and so must all subs and methods DESTROY calls.  Dependency
on the current directory is just another no-no.

> There has GOT to be.. a good way, something that doesn't involve more 
> CPAN modules... to deal with this in a more sane fashion.

As has been mentioned in the other thread, one of the standard methods
to defuse circular refs is to make one of them weak.  It is applicable
when your program is aware when it closes a cycle, (less so when cycles
crop up at random) and the weak ref must be treated with attention: it
can become undefined by some distant action.

Anno
-- 
$_='Just another Perl hacker'; print +( join( '', map { eval $_; $@ }
'use warnings FATAL => "all"; printf "%-1s", "\n"', 'use strict; a',
'use warnings FATAL => "all"; "@x"', '1->m') =~
m|${ s/(.)/($1).*/g; \ $_ }|is),',';


------------------------------

Date: Wed, 08 Feb 2006 09:01:02 +0000
From: Brian Wakem <no@email.com>
Subject: Re: perl cgi script buffering?
Message-Id: <44tqaeF373m9U1@individual.net>

Jim Isaacson wrote:

> Thanks for the info Jim. You were right. On the Linux box I was using
> Firefox and on the pc clients it was IE. I loaded Firefox on a pc and the
> cgi script loads up right away.
> 
> Now I need to see if there is an option or way to kickstart IE.


I have done this in the past by printing lots of hidden data.

print "<!-- nobody will get to see this text, unless they view the source,
but there wont be anything interesting here anyway -->" x 150;



-- 
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png


------------------------------

Date: Wed, 8 Feb 2006 00:25:12 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: problem with XML::Parser dying on errors...
Message-Id: <slrnduj3m8.t4l.tadmc@magna.augustmail.com>

Bruno Boettcher <bboett@bboett.dyndns.org> wrote:

> not well-formed (invalid token) at line 80, column 45, byte 4904 at
> /usr/lib/perl5/XML/Parser.pm line 187
> from the cpan shell:
> XML::Parser is up to date (2.34).
> 
> i mean i would like to deal with the error myself, e.g. spit out the
> data that caused that error... but at the moment i seem unable to stop
> XML::Parser or expat to die on my with no usable info on what is going
> wrong....
> 
> anyway since that thing is supposed to be a daemon, i can't have modules
> dying nad compromising the whole functionality...
> is there any way to stop it from doing that?


You use "eval BLOCK" to handle exceptions in Perl.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 8933
***************************************


home help back first fref pref prev next nref lref last post