[26998] in Perl-Users-Digest
Perl-Users Digest, Issue: 8934 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 8 18:05:58 2006
Date: Wed, 8 Feb 2006 15: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: 8934
Today's topics:
Re: circular references, chdir() and Term::ReadLine::Gn xhoster@gmail.com
Help: How do I get the lists of groups a unix user is i <bhoppe@ti.com>
Re: Help: How do I get the lists of groups a unix user <emschwar@pobox.com>
Re: Help: How do I get the lists of groups a unix user <bhoppe@ti.com>
Re: perl cgi script buffering? xhoster@gmail.com
Re: perl cgi script buffering? <matthew.garrish@sympatico.ca>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 08 Feb 2006 14:58:13 GMT
From: xhoster@gmail.com
Subject: Re: circular references, chdir() and Term::ReadLine::Gnu?
Message-Id: <20060208100055.242$Cw@newsreader.com>
nospam@geniegate.com (Jamie) wrote:
> 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)
1) When I write debugging lines that create a lot homologous messages
written to a log file, I always make sure they have a distinct string in
them. so instead of warning with just DESTROY, I'd warn with
"JJJJJDESTROY: rest of message....". Then I always make one additional
inspection of the log file filtering out that string (say, with 'grep -v
"^JJJJJDESTROY"') just to see what else was in there that wasn't obvious
before.
2) Only make DESTROY methods for classes you think are likely to be
involved in the problem, not for every class you use.
3) Have DESTROY check a global variable or something for it to decide
whether it should actually emit a generic debugging warning or not.
>
> It was buried way deep and I'd forgotten about it.
>
> 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.
I'm not sure, but I suspect you should spend more effort on refactoring
your code to avoid as much as the mess as possible, rather than refactoring
perl to deal with the mess after the fact.
> I remember some time ago reading about a trick using TIESCALAR to
> accomplish this, but I can't seem to recall the method.
At this point, I no longer know what the "this" above refers to.
What are you trying to accomplish with tie, here?
...
> package main;
> circle_three();
> sub circle_three {
> my($a) = new A('Object A');
> my($b) = new B('Object B');
> my($ta,$tb);
>
> # A holds a ref to b.
> tie $tb, 'Circle', $b;
> $a->{b} = $tb;
>
> # B holds a ref to a.
> tie $ta, 'Circle', $a;
> $b->{a} = $ta;
> }
>
> But I still get global destruction on a and b, even though they hold tied
> variables.
$a and $b don't hold tied variables.
$a->{b} holds that thing you get back when you call FETCH on the tied
variable $tb.
$b->{a} holds that thing you get back when you call FETCH on the tied
variable $ta.
The things you get from calling FETCH are not themselves tied.
> Oddly enough, the Circle objects DO get destroyed after leaving the
> circle_three() subroutine.
Of course.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Wed, 08 Feb 2006 15:54:20 -0600
From: Brandon Hoppe <bhoppe@ti.com>
Subject: Help: How do I get the lists of groups a unix user is in?
Message-Id: <dsdpac$230$1@home.itg.ti.com>
I need the list of groups that a user is in, similar to calling "groups" at a command prompt.
I've searched everywhere but haven't been able to find anything to do this in perl.
Thanks
------------------------------
Date: Wed, 08 Feb 2006 15:17:03 -0700
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Help: How do I get the lists of groups a unix user is in?
Message-Id: <etoslqt338g.fsf@wilson.emschwar>
Brandon Hoppe <bhoppe@ti.com> writes:
> I need the list of groups that a user is in, similar to calling "groups" at a command prompt.
What's wrong with
my @groups = split ' ', `groups`;
?
> I've searched everywhere but haven't been able to find anything to do this in perl.
Have you tried anything? I don't mind tossing off a one-liner here or
there, but in general, people in this group resent being asked to do
someone else's work for them, but are more than happy to help correct
any code that you've tried, but failed, to write correctly.
-=Eric
------------------------------
Date: Wed, 08 Feb 2006 16:54:53 -0600
From: Brandon Hoppe <bhoppe@ti.com>
Subject: Re: Help: How do I get the lists of groups a unix user is in?
Message-Id: <dsdsrt$48l$1@home.itg.ti.com>
Eric Schwartz wrote:
> Brandon Hoppe <bhoppe@ti.com> writes:
>
>>I need the list of groups that a user is in, similar to calling "groups" at a command prompt.
>
>
> What's wrong with
>
> my @groups = split ' ', `groups`;
Shoot...didn't even think of that.
>
> ?
>
>
>>I've searched everywhere but haven't been able to find anything to do this in perl.
>
>
> Have you tried anything? I don't mind tossing off a one-liner here or
> there, but in general, people in this group resent being asked to do
> someone else's work for them, but are more than happy to help correct
> any code that you've tried, but failed, to write correctly.
>
> -=Eric
Yeah, I've tried several combinations of the functions getpwuid(), getgrnam(), getgrgid()
etc. But using those I was only able to get the first group listed when you call groups. I
wasn't able to figure out what other group the user was associated with. For example:
my $group = getgrgid((getpwuid($<))[3]);
Only returned the 1st group name listed when you ran groups. Even if the user changed to a
group using 'newgrp' command, it wouldn't give the current group that the user was using.
------------------------------
Date: 08 Feb 2006 15:11:59 GMT
From: xhoster@gmail.com
Subject: Re: perl cgi script buffering?
Message-Id: <20060208101440.932$CT@newsreader.com>
Brian Wakem <no@email.com> wrote:
> 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;
I almost never find that necessary. The OP would be better off just
generating valid html in the first place. If I move the printing of the
<H1><CENTER> stuff from before to after the opening <HTML> tag, then IE
starts behaving the way he wants.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Wed, 8 Feb 2006 17:25:19 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: perl cgi script buffering?
Message-Id: <fduGf.29254$1e5.537791@news20.bellglobal.com>
<xhoster@gmail.com> wrote in message
news:20060208101440.932$CT@newsreader.com...
> Brian Wakem <no@email.com> wrote:
>> 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;
>
> I almost never find that necessary. The OP would be better off just
> generating valid html in the first place. If I move the printing of the
> <H1><CENTER> stuff from before to after the opening <HTML> tag, then IE
> starts behaving the way he wants.
>
You mean print valid html? IE couldn't possibly handle that, could it? : P
Matt
------------------------------
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 8934
***************************************