[25955] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8174 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 15 18:05:35 2005

Date: Wed, 15 Jun 2005 15:05:05 -0700 (PDT)
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, 15 Jun 2005     Volume: 10 Number: 8174

Today's topics:
        Decorator pattern - IO::file <bugbear@trim_papermule.co.uk_trim>
    Re: Decorator pattern - IO::file <nobull@mail.com>
    Re: Regular Expression not working <someone@example.com>
        Script continues running after an exit() call? <mddibern@student.cs.uwaterloo.ca>
    Re: Script continues running after an exit() call? xhoster@gmail.com
        stats (was Re: Regular Expression not working) (Greg Bacon)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 15 Jun 2005 15:44:09 +0100
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Decorator pattern - IO::file
Message-Id: <42b03eb9$0$2049$ed2e19e4@ptn-nntp-reader04.plus.net>

I would (greatly) like to be able to do something a LOT
like pipes, without using (well...) pipes.

I simple want to be able to build sequence
of filters (at least if they were on Unix
they would be called filters)

It appears that I can achive this by embodying
my filter code in the read() method of IO::file
(actually, IO;:handle withing IO::file).

I might also need seek() to work correctly.

However, whilst I understand the general approach,
I would dearly like an example (or something)
to work from.

If anyone can help, I'd be most grateful.

If there is anything like an "adapter"
module for IO::file that would be marvelous.

(An adapter implements everything needed as a noop)

   BugBear



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

Date: Wed, 15 Jun 2005 17:33:43 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Decorator pattern - IO::file
Message-Id: <d8pl98$dij$1@redhat2.bham.ac.uk>

bugbear wrote:
> I would (greatly) like to be able to do something a LOT
> like pipes, without using (well...) pipes.
> 
> I simple want to be able to build sequence
> of filters (at least if they were on Unix
> they would be called filters)

Perl calls them IO layers.

> It appears that I can achive this by embodying
> my filter code in the read() method of IO::file
> (actually, IO;:handle withing IO::file).

You could do that - but you'd be better off using tied filehandles (if 
you need pre-5.8.x compatibility) or PerlIO layers otherwise.



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

Date: Wed, 15 Jun 2005 13:49:28 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Regular Expression not working
Message-Id: <IlWre.56428$HI.37071@edtnps84>

Greg Bacon wrote:
<snip>

I see that you haven't posted the weekly statistics for a while.  Have you 
given up on that?


John
-- 
use Perl;
program
fulfillment


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

Date: Wed, 15 Jun 2005 11:02:22 -0400
From: Debo <mddibern@student.cs.uwaterloo.ca>
Subject: Script continues running after an exit() call?
Message-Id: <Pine.GSO.4.58.0506151101490.18896@cpu18.student.cs.uwaterloo.ca>

I realize this post is going to be noninformative, but the script I'm
writing is rather long and so in the interest of brevity I'd like to just
summarize the problem I'm having.

I've written a script that, in general terms:

1. Opens a log file for writing, using Log:Log4Perl

1. Uses system() to call a program (NCBI BLAST) to associate the data in
two files. BLAST writes out a report of its activity. This report is quite
large (~600 megs).

2. Opens a handle to a postgres database (with AutoCommit off) using DBI.

3. Creates a cached INSERT query, and then parses the report, using this
query to insert lots (~20000) records based on this report. Some of the
insertions fail, but that doesn't really concern me because I sort of
expect the process to be lossy. (I don't know if this screws up the
ability to commit the changes).

4. Commits the changes to the database.

5. Uses the move() method of File::Copy to move the log file to a
different location.

6. Calls exit(0)

Now, here's the rub. The script will sometimes succeed or sometimes fail
to commit, which I think I can fix without much difficulty. However, when
I run this overnight and return in the morning, I INVARIABLY find about
18-20 perl processes running, and the BLAST command still running.

I look at the log that the script generates (in its new location, after
the move() call), and it seems that after the script reaches the exit(0),
it starts the BLAST process again, and continues to do so repeatedly. In
all, BLAST will be called and will complete execution about 3 or 4 times
throughout the course of the night, when the flow of control in the script
quite obviously shows that it should only execute once.

The thing I find especially strange is that the script continues to log
changes to the log file *after it has been moved*! It does this regardless
of whether I use the logger, or a plain filehandle to do my logging. The
script does not output anything pertaining to this problem on stderr (it's
mostly just some gunk that bioperl spits out for no particular reason).

So, I suppose my questions are:

1) Under what circumstances would perl be enticed to spawn a legion of
subprocesses without any explicit fork etc calls in the script?

2) How could these processes continue to write to a file after it has been
moved?

3) Why would a script 'ignore' an exit(0) call?

My platform right now is cygwin (shudder) with perl v5.8.5. I'd love
to be doing this in linux, but external forces have imposed the
environment and now i'm stuck with it.

Any tips you could provide that would help me diagnose the problem would be
appreciated.

Thanks!

-Debo



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

Date: 15 Jun 2005 17:27:57 GMT
From: xhoster@gmail.com
Subject: Re: Script continues running after an exit() call?
Message-Id: <20050615132757.490$xE@newsreader.com>

Debo <mddibern@student.cs.uwaterloo.ca> wrote:
>
> The thing I find especially strange is that the script continues to log
> changes to the log file *after it has been moved*! It does this
> regardless of whether I use the logger, or a plain filehandle to do my
> logging.

On unix/linux, moving a file (within a file system) is little more than
a change in name.  It doesn't effect any already-open handles to that file.

> The script does not output anything pertaining to this problem
> on stderr (it's mostly just some gunk that bioperl spits out for no
> particular reason).

I'd suggest you liberally sprinkle your code with "warn" statements.

warn "$$ I'm about to start BLAST";
#...
warn "$$ I've just finished BLAST";
#...
warn "$$ I'm about to exit";


>
> So, I suppose my questions are:
>
> 1) Under what circumstances would perl be enticed to spawn a legion of
> subprocesses without any explicit fork etc calls in the script?

You are probably mis-interpreting something.

> 3) Why would a script 'ignore' an exit(0) call?

You are probably mis-interpreting something.
You might want to try POSIX::_exit, though I doubt that will
be the problem.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: Wed, 15 Jun 2005 18:20:21 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: stats (was Re: Regular Expression not working)
Message-Id: <11b0sb58ht39f26@corp.supernews.com>

In article <IlWre.56428$HI.37071@edtnps84>,
    John W. Krahn <krahnj@telus.net> wrote:

: I see that you haven't posted the weekly statistics for a while.  Have
: you given up on that?

A while back, I realized I'd missed a week but also noticed the
absence of any clamor over it.

Greg
-- 
Comfort rides shotgun with the temporary.
    -- Daniel Weinshenker


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

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 8174
***************************************


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