[18730] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 898 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 14 18:10:41 2001

Date: Mon, 14 May 2001 15:10:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <989878218-v10-i898@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 14 May 2001     Volume: 10 Number: 898

Today's topics:
    Re: garbage collection in perl (Anno Siegel)
    Re: garbage collection in perl (Craig Berry)
    Re: garbage collection in perl <dan@tuatha.sidhe.org>
    Re: garbage collection in perl <bart.lateur@skynet.be>
    Re: garbage collection in perl <ilya@math.ohio-state.edu>
    Re: garbage collection in perl <ilya@math.ohio-state.edu>
    Re: garbage collection in perl <j.g.karssenberg@student.utwente.nl>
    Re: garbage collection in perl <j.g.karssenberg@student.utwente.nl>
    Re: garbage collection in perl (Anno Siegel)
    Re: Help with my html to txt perl script (Steve)
    Re: How to call perl program from C program ? (Anno Siegel)
        Keeping database connection alive <michael@stroeck.com>
    Re: Keeping database connection alive <brian@stevens.com>
    Re: Keeping database connection alive (reader of news)
        Looking for Perl PGP Utility for Win32 <anomie@my-deja.com>
        nested pattern (Robert Vazan)
        Pattern matcher memory corruption? (no text-wrap this t <jab42@cas.org>
        Pattern matcher memory corruption? <jab42@cas.org>
        Perl 5.6.1 and Unicode <o.moser@mobilkom.at>
    Re: Perl 5.6.1 and Unicode <pne-news-20010514@newton.digitalspace.net>
    Re: perl book <o.moser@mobilkom.at>
    Re: perl book <camerond@mail.uca.edu>
    Re: perl prints asychronously - compiler/interpreter op (John Joseph Trammell)
    Re: perl prints asychronously - compiler/interpreter op <carlos@plant.student.utwente.nl>
    Re: perl prints asychronously - compiler/interpreter op <jesse@uchicago.edu>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 14 May 2001 18:24:10 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: garbage collection in perl
Message-Id: <9dp7sa$fu4$2@mamenchi.zrz.TU-Berlin.DE>

According to carlos <carlos@plant.student.utwente.nl>:

> is a 'my' variable automagically undeffed when it falls out of scope?

What happens with a variable after is goes out of scope[1] is rather
a metaphysical question for a programmer.  All we need to know is that
its contents can be garbage-collected, as the documentation says.

Anno

[1] ...meaning, the refcount goes to zero


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

Date: Mon, 14 May 2001 19:10:22 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: garbage collection in perl
Message-Id: <tg0bcu2li19416@corp.supernews.com>

carlos (carlos@plant.student.utwente.nl) wrote:
: is a 'my' variable automagically undeffed when it falls out of scope?

The variable itself disappears utterly when it falls out of scope.

The value of that variable may persist indefinitely if other references to
it exist.

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "God becomes as we are that we may be as he is."
   |               - William Blake


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

Date: Mon, 14 May 2001 20:41:34 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: garbage collection in perl
Message-Id: <2qXL6.443$v5.49182@news1.rdc1.ct.home.com>

Craig Berry <cberry@cinenet.net> wrote:
> carlos (carlos@plant.student.utwente.nl) wrote:
> : is a 'my' variable automagically undeffed when it falls out of scope?

> The variable itself disappears utterly when it falls out of scope.

That, oddly enough, turns out not to be the case. You can use my
variables as lexcally scoped statics. Whether this is a good idea or
not is an entirely separate question.

					Dan


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

Date: Mon, 14 May 2001 20:50:34 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: garbage collection in perl
Message-Id: <f4h0gtof61sua85hmd5ohtrmag0mrll37j@4ax.com>

carlos wrote:

>is a 'my' variable automagically undeffed when it falls out of scope?

Isn't that just a silly question? Much like: if a tree falls, and
there's nobody to hear it fall, does it make a sound?

A lexical variable is ready for garbage collection if there is no more
reference to it. But without reference, you can't possibly know its
value.

-- 
	Bart.


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

Date: 14 May 2001 20:59:44 GMT
From: Ilya Zakharevich <ilya@math.ohio-state.edu>
Subject: Re: garbage collection in perl
Message-Id: <9dph00$se7$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Craig Berry
<cberry@cinenet.net>], who wrote in article <tg0bcu2li19416@corp.supernews.com>:
> carlos (carlos@plant.student.utwente.nl) wrote:
> : is a 'my' variable automagically undeffed when it falls out of scope?
> 
> The variable itself disappears utterly when it falls out of scope.

This has very litle relation to reality.  Access to "lexical"
variables, as the name indicates, has nothing to do with time.
Contrast with local(), which is governed by "time flow": what come
first, what comes second.

> The value of that variable may persist indefinitely if other references to
> it exist.

The value of that variable *will* persist until the next access (most
often by my(), which undef()s the previous value) unless this value is
an object reference.

Hope this helps,
Ilya


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

Date: 14 May 2001 21:01:42 GMT
From: Ilya Zakharevich <ilya@math.ohio-state.edu>
Subject: Re: garbage collection in perl
Message-Id: <9dph3m$sf2$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Bart Lateur 
<bart.lateur@skynet.be>], who wrote in article <f4h0gtof61sua85hmd5ohtrmag0mrll37j@4ax.com>:
> >is a 'my' variable automagically undeffed when it falls out of scope?
> 
> Isn't that just a silly question? Much like: if a tree falls, and
> there's nobody to hear it fall, does it make a sound?
> 
> A lexical variable is ready for garbage collection if there is no more
> reference to it.

 ... and the only way to achieve this is to undef() the subroutine the
variable belongs to.

Ilya


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

Date: Mon, 14 May 2001 21:14:58 -0000
From: "Pardus" <j.g.karssenberg@student.utwente.nl>
Subject: Re: garbage collection in perl
Message-Id: <9dphlp$fn7$1@dinkel.civ.utwente.nl>



> What happens with a variable after is goes out of scope[1] is rather
> a metaphysical question for a programmer.  All we need to know is that
> its contents can be garbage-collected, as the documentation says.

a metafysical question ... then philosophy learns us we should take three
points in account:

a) the nature of the variable's reality
b) the existence of some kind of God in this reality
and c) the position of the variable in relation with this reality and the
contigent God of this reality
so it should be to define a metafysical question

you first can assume this God to have all the features of a ordinary nerd
(b) -it's perl after all (the reality (a))-
and since no nerd will have a afterlife in mind for variables that are out
of scope (c the variable is inferior
in realation to it's God), you may conclude they vanishe in the great
Nothingness.

Pardus

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

What's Good,
and what's not Good, Pheadrus
do we need anyone to tell us these things ?




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

Date: Mon, 14 May 2001 21:21:57 -0000
From: "Pardus" <j.g.karssenberg@student.utwente.nl>
Subject: Re: garbage collection in perl
Message-Id: <9dpi2r$g82$1@dinkel.civ.utwente.nl>

> Isn't that just a silly question? Much like: if a tree falls, and
> there's nobody to hear it fall, does it make a sound?

How Zen ..

But against this argument most philosophers argue that there is a
God/supreme being to hear the sound,
or even to make the sound happen.In the light of my other post in this
series I would say that this supreme being
over the variable is the perl nerd - so if even the "God" doesn't hear the
sound there is no reality
sustaining the sound: ergo it doesn't exists!

pardus

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

Het beste is het, het raadsel te vergroten.




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

Date: 14 May 2001 21:19:21 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: garbage collection in perl
Message-Id: <9dpi4p$fu4$4@mamenchi.zrz.TU-Berlin.DE>

According to Ilya Zakharevich  <ilya@math.ohio-state.edu>:
> [A complimentary Cc of this posting was sent to
> Craig Berry
> <cberry@cinenet.net>], who wrote in article <tg0bcu2li19416@corp.supernews.com>:
> > carlos (carlos@plant.student.utwente.nl) wrote:
> > : is a 'my' variable automagically undeffed when it falls out of scope?
> > 
> > The variable itself disappears utterly when it falls out of scope.
> 
> This has very litle relation to reality.  Access to "lexical"
> variables, as the name indicates, has nothing to do with time.
> Contrast with local(), which is governed by "time flow": what come
> first, what comes second.
> 
> > The value of that variable may persist indefinitely if other references to
> > it exist.
> 
> The value of that variable *will* persist until the next access (most
> often by my(), which undef()s the previous value) unless this value is
> an object reference.

I'm not sure I understand.  In which way is an object reference treated
differently from other scalars?  Is it not reset by my()?  Or is it not
retained until the next access?  I can't seem to find a code example
that supports either reading.

Anno


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

Date: 14 May 2001 18:08:58 GMT
From: steve@zeropps.uklinux.net (Steve)
Subject: Re: Help with my html to txt perl script
Message-Id: <slrn9g07m6.c0a.steve@zero-pps.localdomain>

On Sun, 13 May 2001 09:58:27 -0700, newuser wrote:

>If someone has a better script that works and if I can use it that sure
>would be appreciated.
>thanks for your help and time.

I think that I have something that does what you want to do:

http://www.zeropps.uklinux.net/cgi-bin/viewimages.cgi

The script allows you to view images and their locations or to
view the document source.

HTH

-- 
Cheers
Steve              email mailto:steve@zeropps.uklinux.net

%HAV-A-NICEDAY Error not enough coffee  0 pps. 

web http://www.zeropps.uklinux.net/

or  http://start.at/zero-pps

  6:26pm  up 101 days, 19:14,  2 users,  load average: 1.63, 1.41, 1.30


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

Date: 14 May 2001 18:29:15 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How to call perl program from C program ?
Message-Id: <9dp85r$fu4$3@mamenchi.zrz.TU-Berlin.DE>

According to Jim Cheng  <jim_pku@yahoo.com>:
> Hi,
> 
>    Does anyone know how to call a per subroutine from C program ?

"perldoc perlembed" will give you a start, but that's not all
you'll have to read.  It isn't trivial.

Anno


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

Date: Mon, 14 May 2001 21:14:17 +0200
From: "Michael Ströck" <michael@stroeck.com>
Subject: Keeping database connection alive
Message-Id: <3b002e60@e-post.inode.at>

Hi all !

I have the following code:

<snip>
my $dbh = DBI->connect ("DBI:mysql:database=forum;host=localhost","",
"",{'RaiseError' => 1}) or
die "Can't connect to database: $DBI::errstr";

my $sth = $dbh->prepare ("INSERT INTO users VALUES(NULL,?,?,?,?)");

$sth->execute($user, $password, $description, $email)
#  ^^^^^^^^^^ this fails and and the programm terminates here.

my $err = $DBI::errstr;
print $err;
$dbh->disconnect();
# ^^^^^^^^^^^^^^ I'd like to get here....
<snip>

How do I keep the connection ?

Any help appreciated

Michael Ströck




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

Date: Mon, 14 May 2001 13:26:40 -0600
From: Brian Stevens <brian@stevens.com>
Subject: Re: Keeping database connection alive
Message-Id: <3B003170.813A47B3@stevens.com>

a) there should be a semicolon (";") at the end of the offending line

b) what is the error message?

Brian

"Michael Ströck" wrote:
> 
> Hi all !
> 
> I have the following code:
> 
> <snip>
> my $dbh = DBI->connect ("DBI:mysql:database=forum;host=localhost","",
> "",{'RaiseError' => 1}) or
> die "Can't connect to database: $DBI::errstr";
> 
> my $sth = $dbh->prepare ("INSERT INTO users VALUES(NULL,?,?,?,?)");
> 
> $sth->execute($user, $password, $description, $email)
> #  ^^^^^^^^^^ this fails and and the programm terminates here.
> 
> my $err = $DBI::errstr;
> print $err;
> $dbh->disconnect();
> # ^^^^^^^^^^^^^^ I'd like to get here....
> <snip>
> 
> How do I keep the connection ?
> 
> Any help appreciated
> 
> Michael Ströck

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Brian Stevens                 STEVENS.COM, Inc.
  brian@stevens.com                 (303)638-1366
        Systems Administration Consultant
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: Mon, 14 May 2001 19:28:01 GMT
From: newsreader@mediaone.net (reader of news)
Subject: Re: Keeping database connection alive
Message-Id: <slrn9g0cf4.2m5.newsreader@dragon.universe>

On Mon, 14 May 2001 21:14:17 +0200, Michael Ströck <michael@stroeck.com> wrote:
>
>$sth->execute($user, $password, $description, $email)
>#  ^^^^^^^^^^ this fails and and the programm terminates here.
>
>my $err = $DBI::errstr;

It fails because you don't have semi-colon?


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

Date: Mon, 14 May 2001 12:56:51 -0700
From: "Jordan Reed" <anomie@my-deja.com>
Subject: Looking for Perl PGP Utility for Win32
Message-Id: <3b003893@monitor.lanset.com>

I'm looking for a Perl module or utility that will give me a simple
interface to PGP Encryption/Decryption in the Win32 environment.

I've looked through the modules at CPAN, but been a little confused as to
how they work and if they work under the Win32 environment.  I'd appreciate
someone who can point me somewhere that is known to work in Win32 without
too much hassle.

The basic gist is that I have an application that sends out E-mail to users.
I'd like to add in the feature of having the mails be PGP encrypted if the
user has entered their public key.

thanks,
-jdr




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

Date: Sun, 13 May 2001 07:34:15 GMT
From: robova@nextra.sk (Robert Vazan)
Subject: nested pattern
Message-Id: <3afe35be.3391035@news.nextra.sk>

What do you do with nested patterns? I mean something like:

{ "foo\"bar" { ....; } (m@b}a\@z@ && do {...} ) ... }

Or {}'s with few //'s and ""'s inside. I don't need to see
into that string, just identify it. I don't want to write
specialized parser, when 99% cases are so simple.

/Robert



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

Date: Mon, 14 May 2001 17:38:04 -0400
From: John Bower <jab42@cas.org>
Subject: Pattern matcher memory corruption? (no text-wrap this time - hopefully)
Message-Id: <3B00503C.716CC4FF@cas.org>

(My last post got text-wrapped - here's a second attempt...)

Briefly, I get incorrect pattern match behavior when processing very
large text files. The same code seems to work flawlessly on the same
records in smaller files. Strangely, if I wrap the code in an eval,
it works fine.

I am wondering if I could be experiencing some memory corruption within
Perl's pattern matching routines after processing several hundred
thousand records? I thought perhaps the eval caused the interpreter to
create a new pattern match object with an untainted memory space. For
the curious, details and code excerpts are below...

Thanks!

--------
John A. Bower                              Chemical Abstract Services
Dept. 42 Database Quality Engineering      2540 Olentangy River Road
x2703                                      Columbus, OH 43210-0012
jbower@cas.org                             (614) 447-3600
--------

I had written a placeholder for a function which was to accept a
reference to an array of strings, a reference to a search string, and
was to return true or false depending on whether the first string in the
referenced array contained the search string. I eventually filled in the
placeholder with the following lines:

   
    ################################################################################
    #   This subroutine accepts an array ref to CN names. It returns TRUE if the   #
    #   first (NT1) name was a "hit". In order to do this, the routine is passed   #
    #   a second argument, which is a ref to the search string.                    # 
    ################################################################################
    sub NT1Hit {
        my $cnRef = shift;
        my $searchRef = shift;
        my $pattern = makePattern($$searchRef);
        my $nt1 = $cnRef->[0];
        if ($nt1 =~ m/$pattern/i) {
            return 1;
        } else {
            if ($debug) {
                print STDERR "    NT1 did NOT hit ($pattern): $cnRef->[0]\n";
            }
        }
        return 0;
    }

   
    ################################################################################
    #   This subroutine escapes characters that have special significance in Perl  #
    #   patterns.                                                                  #  
    ################################################################################
    sub makePattern {
        my $string = $_[0];
        $string =~ s/([\-,\/()\[\]?\.\*\+])/\\\1/og;
        return $string;
    }
 
The routines work fine with sample data sets of 10,000 records, but
start misbehaving in the midst of  processing larger datasets of 600,000
and up. For example, I get lines like this in the debugging output:
 
    ----------------------------------------
    search results for    144940-98-7 NT1: Guanylin
    NT1 did NOT hit (Guanylin): 3-86-Uroguanylin, pro- [3-methionine] (human clone pHUG31)
    NT1 did NOT hit (Guanylin): 2-86-Uroguanylin, pro- [2-methionine] (human clone pHUG31)
    ----------------------------------------

when clearly "Guanylin" is a substring in both of those strings if you
ignore case. Curiously, these errors do not occur when the same record
is placed in a smaller file. The following work-around fixes the problem,
but it makes me nervous as I do not know WHY:

   
    ################################################################################
    #   This subroutine accepts an array ref to CN names. It returns TRUE if the   #
    #   first (NT1) name was a "hit". In order to do this, the routine is passed   #
    #   a second argument, which is a ref to the search string.                    # 
    ################################################################################
    sub NT1Hit {
        my $cnRef = shift;
        my $searchRef = shift;
        my $pattern = makePattern($$searchRef);
        my $nt1Match = 0;
        my $nt1 = $cnRef->[0];
        my $code = "if (\$nt1 =~ m/$pattern/i) { \$nt1Match = 1;}"; 
        eval($code);
        if ($nt1Match) {
            return 1;
        } else {
            if ($debug) {
                print STDERR "    NT1 did NOT hit ($pattern): $cnRef->[0]\n";
            }
        }
        return 0;
    }

Could I be experiencing some memory corruption within Perl's pattern
matching routines? I know very little of the internals of Perl...

Thanks again...


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

Date: Mon, 14 May 2001 17:27:15 -0400
From: John Bower <jab42@cas.org>
Subject: Pattern matcher memory corruption?
Message-Id: <3B004DB3.EAF64F92@cas.org>

Briefly, I get incorrect pattern match behavior when processing very
large text
files. The same code seems to work flawlessly on the same records in
smaller
files. Strangely, if I wrap the code in an eval, it works fine.

I am wondering if I could be experiencing some memory corruption within
Perl's pattern matching routines after processing several hundred
thousand
records? I thought perhaps the eval caused the interpreter to create a
new
pattern match object with an untainted memory space. For the curious,
details
and code excerpts are below...

Thanks!

--------
John A. Bower                              Chemical Abstract Services
Dept. 42 Database Quality Engineering      2540 Olentangy River Road
x2703                                      Columbus, OH 43210-0012
jbower@cas.org                             (614) 447-3600
--------

I had written a placeholder for a function which was to accept a
reference to
an array of strings, a reference to a search string, and was to return
true
or false depending on whether the first string in the referenced array
contained the search string. I eventually filled in the placeholder with
the
following lines:

   
################################################################################
    #   This subroutine accepts an array ref to CN names. It returns
TRUE if the   #
    #   first (NT1) name was a "hit". In order to do this, the routine
is passed   #
    #   a second argument, which is a ref to the search
string.                    #
   
################################################################################
    sub NT1Hit {
        my $cnRef = shift;
        my $searchRef = shift;
        my $pattern = makePattern($$searchRef);
        my $nt1 = $cnRef->[0];
        if ($nt1 =~ m/$pattern/i) {
            return 1;
        } else {
            if ($debug) {
                print STDERR "    NT1 did NOT hit ($pattern):
$cnRef->[0]\n";
            }
        }
        return 0;
    }

   
################################################################################
    #   This subroutine escapes characters that have special
significance in Perl  #
    #  
patterns.                                                                 
#
   
################################################################################
    sub makePattern {
        my $string = $_[0];
        $string =~ s/([\-,\/()\[\]?\.\*\+])/\\\1/og;
        return $string;
    }
 
The routines work fine with sample data sets of 10,000 records, but
start
misbehaving in the midst of  processing larger datasets of 600,000 and
up.
For example, I get lines like this in the debugging output:
 
    ----------------------------------------
    search results for    144940-98-7 NT1: Guanylin
    NT1 did NOT hit (Guanylin): 3-86-Uroguanylin, pro- [3-methionine]
(human clone pHUG31)
    NT1 did NOT hit (Guanylin): 2-86-Uroguanylin, pro- [2-methionine]
(human clone pHUG31)
    ----------------------------------------

when clearly "Guanylin" is a substring in both of those strings if you
ignore case. Curiously, these errors do not occur when the same record
is
placed in a smaller file. The following work-around fixes the problem,
but
it makes me nervous as I do not know WHY:

   
################################################################################
    #   This subroutine accepts an array ref to CN names. It returns
TRUE if the   #
    #   first (NT1) name was a "hit". In order to do this, the routine
is passed   #
    #   a second argument, which is a ref to the search
string.                    #
   
################################################################################
    sub NT1Hit {
        my $cnRef = shift;
        my $searchRef = shift;
        my $pattern = makePattern($$searchRef);
        my $nt1Match = 0;
        my $nt1 = $cnRef->[0];
        my $code = "if (\$nt1 =~ m/$pattern/i) { \$nt1Match = 1;}"; 
        eval($code);
        if ($nt1Match) {
            return 1;
        } else {
            if ($debug) {
                print STDERR "    NT1 did NOT hit ($pattern):
$cnRef->[0]\n";
            }
        }
        return 0;
    }

Could I be experiencing some memory corruption within Perl's pattern
matching
routines? I know very little of the internals of Perl...

Thanks again...


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

Date: Mon, 14 May 2001 20:01:31 +0200
From: Oliver Moser <o.moser@mobilkom.at>
Subject: Perl 5.6.1 and Unicode
Message-Id: <4370gt0fjrteqf52l6gumqu9nniasfrghu@4ax.com>

Dear NG,

	Does anybody know how to convert a Latin 1 string to utf8 with
Perl 5.6.1? The formerly good working tr/$string//CU does not work any
longer;

Thanx in advance

Oliver
 ------------------------------
Oliver Moser
mobilkom austria AG & Co. KG
IT://mob.app
Mobil: +43-664-331-2544
mailto:o.moser@mobilkom.at


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

Date: Mon, 14 May 2001 21:51:28 +0200
From: Philip Newton <pne-news-20010514@newton.digitalspace.net>
Subject: Re: Perl 5.6.1 and Unicode
Message-Id: <hnd0gt4mopfkt2nf25tm9rf1f6i4ff8m77@4ax.com>

On Mon, 14 May 2001 20:01:31 +0200, Oliver Moser <o.moser@mobilkom.at>
wrote:

> 	Does anybody know how to convert a Latin 1 string to utf8 with
> Perl 5.6.1?

One way is with the Unicode::String module.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Mon, 14 May 2001 20:04:04 +0200
From: Oliver Moser <o.moser@mobilkom.at>
Subject: Re: perl book
Message-Id: <1f70gtk0p5tg3adhdr6ut3pcgepbueqno2@4ax.com>

On Mon, 14 May 2001 12:28:50 -0400, "Frank A" <frank673@hotmail.com>
wrote:

>Hi,
>Can anyone refer to a good perl book Thanks.
>
>Frank
>
>

Network Programming with Perl
by Lincoln D. Stein


 ------------------------------
Oliver Moser
mobilkom austria AG & Co. KG
IT://mob.app
Mobil: +43-664-331-2544
mailto:o.moser@mobilkom.at


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

Date: Mon, 14 May 2001 13:41:53 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: perl book
Message-Id: <3B0026F1.CADBB9E6@mail.uca.edu>

Paul Boardman wrote:
> 
> Frank A wrote:
> >
> > Hi,
> > Can anyone refer to a good perl book Thanks.
> >
> 
> <groan>  this should be a FAQ.
> 
> oh, I just checked... it is.
> 
> `perldoc -q book` gave me the following :-
> 
> =head1 Found in /usr/lib/perl5/5.00503/pod/perlfaq2.pod
> 
> =head2 Perl Books
> 
> A number of books on Perl and/or CGI programming are available.  A few
> of
> these are good, some are ok, but many aren't worth your money.  Tom
> Christiansen maintains a list of these books, some with extensive
> reviews, at http://www.perl.com/perl/critiques/index.html.

Actually, I recently wrote to Tom to ask if he might be able to update
his Critiques page, but apparently (and, if so, understandably), he
isn't able to do it right now. There are several good books out there
which are not mentioned because they are too recent for the review page.
Is Uri's (sorry, uri's) page still up, and/or are there others out there
that we should be pointing to for coverage of the recent literature?

Cameron

-- 
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu


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

Date: Mon, 14 May 2001 18:06:39 GMT
From: trammell@bayazid.hypersloth.invalid (John Joseph Trammell)
Subject: Re: perl prints asychronously - compiler/interpreter optimization?
Message-Id: <slrn9g05b4.12m.trammell@bayazid.hypersloth.net>

On Mon, 14 May 2001 13:03:28 -0500, Jesse James Jensen wrote:
> Sometimes, when a program is going to take a long time to do something,
> I want it to print out little status messages for me (mostly just when
> I'm still writing it).  The problem is that they don't really help. 

Try using 'warn' instead of 'print'.  Or read up on special variable $|.



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

Date: Mon, 14 May 2001 20:25:11 +0200
From: "carlos" <carlos@plant.student.utwente.nl>
Subject: Re: perl prints asychronously - compiler/interpreter optimization?
Message-Id: <9dp7mo$9c0$1@dinkel.civ.utwente.nl>

$|=1;

"Jesse James Jensen" <jesse@uchicago.edu> wrote in message
news:3B001DF0.FF782677@uchicago.edu...
> Sometimes, when a program is going to take a long time to do something,
> I want it to print out little status messages for me (mostly just when
> I'm still writing it).  The problem is that they don't really help.
> With code like this:
>
> ##### START #####
> #!/usr/bin/perl
> use strict;
> my $i = 0;
>
> print "Opening file... ";
> open (BIGFILE, "bigfile.txt") or die "File not found.\n";
> print "Done\n";
>
> print "Arrayifying file... ";
> @input  =   <BIGFILE>;
> print "Done\n";
>
> print "Closing file... ";
> close BIGFILE;
> print "Done\n";
>
> print "Doing complicated stuff... ";
> foreach my $line (@input) {
> # do various perlfunctions to $line here
> $i++;
> print "."  if (  ($i %   500)  == 0 );
> print "\n" if (  ($i % 25000)  == 0 );
> }
> print "\nDone\n";
> ##### END #####
>
> What happens when I run is that the program waits, then prints out
> "Opening file... Done" all at once, then waits, and prints out
> "Arrayifying file... Done" all at once, then waits, then prints out
> "Closing file... Done" all at once, then waits and prints out a row of
> dots all at once, then waits and prints out another row of dots, until
> it's done.
>
> Why does perl do this?  Is it some quirk of the optimizer that puts
> printing in a different thread than doing other stuff?  It seems that
> perl considers printing a newline to be more noteworthy than printing
> things on the same line.  Is there a way to make it DWIW without
> hampering performance?
>
>
> jjj




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

Date: Mon, 14 May 2001 14:20:24 -0500
From: Jesse James Jensen <jesse@uchicago.edu>
Subject: Re: perl prints asychronously - compiler/interpreter optimization?
Message-Id: <3B002FF8.A5802FF3@uchicago.edu>

John Joseph Trammell wrote:
> 
> On Mon, 14 May 2001 13:03:28 -0500, Jesse James Jensen wrote:
> > Sometimes, when a program is going to take a long time to do something,
> > I want it to print out little status messages for me (mostly just when
> > I'm still writing it).  The problem is that they don't really help.
> 
> Try using 'warn' instead of 'print'.  Or read up on special variable $|.


Ah, the answers really *are* all in the documentation.  I had avoided
reading about the predefined variables because they made my head hurt. 
And I never use awk, so I don't feel the need to emulate it.

Is there a performance hit with autoflushing?


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

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.  

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


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