[31055] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2300 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 26 16:09:46 2009

Date: Thu, 26 Mar 2009 13:09:12 -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           Thu, 26 Mar 2009     Volume: 11 Number: 2300

Today's topics:
    Re: Debian MySQL Perl  DBI - connection terminates unex <glex_no-spam@qwest-spam-no.invalid>
        first sentence regexp? <bugbear@trim_papermule.co.uk_trim>
    Re: first sentence regexp? <cartercc@gmail.com>
    Re: first sentence regexp? <cwilbur@chromatico.net>
    Re: first sentence regexp? <uri@stemsystems.com>
        Free Solaris 10 root account and training <kartik.vashishta@gmail.com>
        hash of arrays... preacher37@gmail.com
    Re: hash of arrays... <glennj@ncf.ca>
    Re: hash of arrays... <cartercc@gmail.com>
    Re: hash of arrays... <cartercc@gmail.com>
    Re: hash of arrays... <darkon.tdo@gmail.com>
    Re: help with IO::Socket:INET <ebabin@yahoo.com>
    Re: logic, algorithms, and (Perl) data structures <cartercc@gmail.com>
    Re: logic, algorithms, and (Perl) data structures <uri@stemsystems.com>
    Re: monitoring oracle rac services <tadmc@seesig.invalid>
        Net::SSH::Perl Help <vendion@charter.net>
    Re: Sharing BerkeleyDB among forked children <paul.marquess@btinternet.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 26 Mar 2009 10:42:00 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Debian MySQL Perl  DBI - connection terminates unexpectedly after 100 secs.
Message-Id: <49cba248$0$87064$815e3792@news.qwest.net>

John wrote:
> "Xho Jingleheimerschmidt" <xhoster@gmail.com> wrote in message 
> news:49bf08ca$0$9725$ed362ca5@nr5-q3a.newsreader.com...
>> John wrote:
>>> Hi
>>>
>>> I'm updating a MySQL table with about 2 million records.  After about 100 
>>> seconds the program ends with no error message.

[...]

> 
> Yes I have now found that error log.  There is a special log for slow 
> queries.  So evidently MySQL are aware that some constructs do take a long 
> time.

I'm confused.. Are you doing a query or an update?

A long running query should be noted so it can possibly be fixed
by adding indexes, temp tables, etc.

> I am not certain whether it is a Perl problem.  My feeling now it is a MySQL 
> problem and that they are aware of similar problems.

It's not a perl problem or a MySQL 'problem'.  They both can handle
running for a looooong time.

If you're going to run a loooooong update, and have it kicked off by
an Apache process (which, BTW you didn't mention in the beginning),
then don't mess with Apache, simply fork the MySQL update process
so Apache doesn't have to keep the connection open.



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

Date: Thu, 26 Mar 2009 15:32:32 +0000
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: first sentence regexp?
Message-Id: <vqCdnUD00euNPVbUnZ2dnUVZ8tyWnZ2d@posted.plusnet>

I would like to pick out the first sentence of some
text, so that it can be manipulated (displayed, indexed)
differently from the rest of the text.

The text is HTML (which doesn't help), so there may be tags
mixed in. And I'm struggling to avoid getting spurious "ends"
from things like the decimal point in numbers, and abbreviations
e.g. "e.g."

Anyone done this before, and got a decent answer?

I'm aware that any regexp will only be an approximate solution,
but I'm hoping it will be "good enough"

   BugBear


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

Date: Thu, 26 Mar 2009 10:46:51 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: first sentence regexp?
Message-Id: <71b3ad8f-4aca-4ec8-ac4b-cf37a898c40b@f19g2000yqo.googlegroups.com>

On Mar 26, 11:32=A0am, bugbear <bugbear@trim_papermule.co.uk_trim>
wrote:
> I would like to pick out the first sentence of some
> text, so that it can be manipulated (displayed, indexed)
> differently from the rest of the text.
>
> The text is HTML (which doesn't help), so there may be tags
> mixed in. And I'm struggling to avoid getting spurious "ends"
> from things like the decimal point in numbers, and abbreviations
> e.g. "e.g."
>
> Anyone done this before, and got a decent answer?
>
> I'm aware that any regexp will only be an approximate solution,
> but I'm hoping it will be "good enough"
>
> =A0 =A0BugBear

Actually, I think that HTML makes it easier rather than harder. My
approach would be to take the first period(.), bang(!), or question(?)
after '<p' that is preceded by anything other than a space and
followed by any kind of space character. I just looked at a bunch of
text marked up in HTML and this seems to work. <p> can have attributes
(like style), but sentences in English are ended only by (.), (!), or
(?) that are followed by a space, and are generally not preceded by a
space.

As an alternative, you might be able to use an arbitrary number of
characters ending at a word boundry, regardless of the end of the
sentence. This would at least make your output uniform, assuming that
you are using a monospace font.

CC


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

Date: Thu, 26 Mar 2009 15:22:27 -0400
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: first sentence regexp?
Message-Id: <86fxh0f5sc.fsf@mithril.chromatico.net>

>>>>> "cc" == ccc31807  <cartercc@gmail.com> writes:

    cc> Actually, I think that HTML makes it easier rather than
    cc> harder. My approach would be to take the first period(.),
    cc> bang(!), or question(?)  after '<p' that is preceded by anything
    cc> other than a space and followed by any kind of space
    cc> character. I just looked at a bunch of text marked up in HTML
    cc> and this seems to work. 

<p>I shall be sure to inform Dr. Jones and Mrs. Miller about the
success you have had; shall I invite them around to tea at 4
p.m. today?<?p>

Charlton


-- 
Charlton Wilbur
cwilbur@chromatico.net


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

Date: Thu, 26 Mar 2009 14:59:19 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: first sentence regexp?
Message-Id: <x7d4c42gyw.fsf@mail.sysarch.com>

>>>>> "CW" == Charlton Wilbur <cwilbur@chromatico.net> writes:

>>>>> "cc" == ccc31807  <cartercc@gmail.com> writes:
  cc> Actually, I think that HTML makes it easier rather than
  cc> harder. My approach would be to take the first period(.),
  cc> bang(!), or question(?)  after '<p' that is preceded by anything
  cc> other than a space and followed by any kind of space
  cc> character. I just looked at a bunch of text marked up in HTML
  cc> and this seems to work. 

  CW> <p>I shall be sure to inform Dr. Jones and Mrs. Miller about the
  CW> success you have had; shall I invite them around to tea at 4
  CW> p.m. today?<?p>

are we all invited? i would feel insulted if i didn't get an invitation!

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Thu, 26 Mar 2009 08:47:10 -0700 (PDT)
From: Kartik_Vashishta <kartik.vashishta@gmail.com>
Subject: Free Solaris 10 root account and training
Message-Id: <a85ea567-4cdb-43c3-a60a-6073a7f0e41e@d2g2000pra.googlegroups.com>

Comfort and Peace, I wish you.


You have root access on a Solaris 10 system. About breaking something,
do not worry.

username: root

password:

(just hit "enter")


To you, I decided to provide root access. Root access, will, help you
to learn.


This is a non-global zone, so, certain features may be not present.


You may, on this system,install packages(install web servers etc), you
may, install patches(learn how to patch a Solaris system), you may
install software, etc..... http://sunfreeware.com offers many free
packages....do not hesitate to install any you like.... http://sunsolve.sun.com
offers free Sun patches, try installing some. If you have any problem,
then, to contact me, do not hesitate.

Try to keep connection on, sometimes the connection may, "time
out"....I'm working on fixing it.... Play around with the
system..learn, enjoy..

What I may do to help, let me know. How to connect to the system: You
may, on the dos prompt, type: telnet 98.215.91.249 2033 (the spaces
between, the word, "telnet", and, "98.215.91.249", and, "2033" are
important)

or

Download and install putty, putty is, among other things, "a telnet
client". In putty, you may "store" your session connection stuff....
encure "telnet" is checked, replace the 23 by 2033, put in the IP
address...give it a name...save click "open", "load" is different from
"open"....ENSURE that the correct data is in your saved session:
98.215.91.249 and 2033

So, you have a free account, you even have root access, what next? Get
a look and feel of the sotware, familiarize yourself. Try some of the
exercises mentioned. http://www.kartik.com/FreeUNIXTraining.html Try
installing software. Try installing patches. For instance, you may
install apache and serve web pages....let me know if you need help....

Thanks to my girlfriend, for, helping me provide this.


Kartik Vashishta


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

Date: Thu, 26 Mar 2009 11:38:43 -0700 (PDT)
From: preacher37@gmail.com
Subject: hash of arrays...
Message-Id: <0f070b1b-a982-456e-b897-5e4e2c19819e@s22g2000prg.googlegroups.com>

for (@some_array) {
  @new_array = &do_someting_elesewhere($_);

  # ceate a hash using an element from the array as a key
  $some_hash{$new_array[2]} = @new_array;
}

  So, how do I see the n^th element of each array?

foreach $key (keys %some_hash) {
  print $some_hash{$key}[n^th];
}

no workey...

I've tried a million of those impenetrable variations i.e. @{$some_hash
[n^th]}, etc. but cant find the right syntax. Any help?


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

Date: 26 Mar 2009 18:57:32 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: hash of arrays...
Message-Id: <slrngsnk0u.ijf.glennj@smeagol.ncf.ca>

At 2009-03-26 02:38PM, "preacher37@gmail.com" wrote:
>  for (@some_array) {
>    @new_array = &do_someting_elesewhere($_);
>  
>    # ceate a hash using an element from the array as a key
>    $some_hash{$new_array[2]} = @new_array;

Try:
     $some_hash{$new_array[2]} = \@new_array;
or
     $some_hash{$new_array[2]} = [@new_array];

What you're doing is storing the length of @new_array instead of a
reference to @new_array.


-- 
Glenn Jackman
    Write a wise saying and your name will live forever. -- Anonymous


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

Date: Thu, 26 Mar 2009 12:05:56 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: hash of arrays...
Message-Id: <86da963f-71c3-41f3-917a-30cb0255826c@e18g2000yqo.googlegroups.com>

CODE:
my @languages = (
	{
		language => 'FORTRAN',
		inventor => 'Backus',
		year     => '1954',
	},
	{
		language => 'COBOL',
		inventor => 'Hopper',
		year     => '1959',
	},
	{
		language => 'Lisp',
		inventor => 'McCarthy',
		year     => '1968',
	},
	{
		language => 'Perl',
		inventor => 'Wall',
		year     => '1986',
	},
	{
		language => 'Python',
		inventor => 'van Rossum',
		year     => '1989',
	},
	{
		language => 'Ruby',
		inventor => 'Matz',
		year     => '1993',
	},
);

print "$languages[0]{language} was invented in $languages[0]{year},
but our favorite, $languages[3]{language} is still the best. Except
for God, who uses $languages[2]{language}.\n";

OUTPUT:
C:\PerlLearn>perl arr_hashes.plx
FORTRAN was invented in 1954, but our favorite, Perl is still the
best. Except for God, who uses Lisp.

C:\PerlLearn>


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

Date: Thu, 26 Mar 2009 12:16:33 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: hash of arrays...
Message-Id: <e7a6c5dc-b50a-4bce-babd-83c55ddfe064@z1g2000yqn.googlegroups.com>

Maybe it would help if I pasted the whole script, note the for loop.
CODE:
my @languages = (
	{
		language => 'FORTRAN',
		inventor => 'Backus',
		year     => '1954',
	},
	{
		language => 'COBOL',
		inventor => 'Hopper',
		year     => '1959',
	},
	{
		language => 'Lisp',
		inventor => 'McCarthy',
		year     => '1968',
	},
	{
		language => 'Perl',
		inventor => 'Wall',
		year     => '1986',
	},
	{
		language => 'Python',
		inventor => 'van Rossum',
		year     => '1989',
	},
	{
		language => 'Ruby',
		inventor => 'Matz',
		year     => '1993',
	},
);

print "$languages[0]{language} was invented in $languages[0]{year},
but our favorite, $languages[3]{language} is still the best. Except
for God, who uses $languages[2]{language}.\n";

foreach (my $i = 0; $i < @languages; $i++)
{
	print "In the array, the reference to the hash is $languages[$i]\n";
	print "$languages[$i]{language} invented by $languages[$i]{inventor}
in $languages[$i]{year}\n\n";
}

OUTPUT:

C:\PerlLearn>perl arr_hashes.plx
FORTRAN was invented in 1954, but our favorite, Perl is still the
best. Except for God, who uses Lisp.
In the array, the reference to the hash is HASH(0x235288)
FORTRAN invented by Backus in 1954

In the array, the reference to the hash is HASH(0x235390)
COBOL invented by Hopper in 1959

In the array, the reference to the hash is HASH(0x182f9a8)
Lisp invented by McCarthy in 1968

In the array, the reference to the hash is HASH(0x18353b4)
Perl invented by Wall in 1986

In the array, the reference to the hash is HASH(0x18353f0)
Python invented by van Rossum in 1989

In the array, the reference to the hash is HASH(0x183542c)
Ruby invented by Matz in 1993


C:\PerlLearn>


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

Date: Thu, 26 Mar 2009 16:01:02 -0400
From: "darkon" <darkon.tdo@gmail.com>
Subject: Re: hash of arrays...
Message-Id: <iMadnSlYQdhnQ1bUnZ2dnUVZ_gqWnZ2d@supernews.com>


"ccc31807" <cartercc@gmail.com> wrote in message 
news:86da963f-71c3-41f3-917a-30cb0255826c@e18g2000yqo.googlegroups.com...
>
> OUTPUT:
> C:\PerlLearn>perl arr_hashes.plx
> FORTRAN was invented in 1954, but our favorite, Perl is still the
> best. Except for God, who uses Lisp.

Well, sort of....

http://xkcd.com/224/



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

Date: Thu, 26 Mar 2009 11:44:57 -0700 (PDT)
From: deja_vu_was_better <ebabin@yahoo.com>
Subject: Re: help with IO::Socket:INET
Message-Id: <3c0bed90-52d8-478a-b771-814af07e9b73@v28g2000vbb.googlegroups.com>

On Mar 26, 10:28=A0am, Ben Morrow <b...@morrow.me.uk> wrote:
> Quoth me <eba...@yahoo.com>:
>
> > Hi, I'm using IO::Socket:INET in a client/server connect and all is
> > working well but I want to restrict connections on the server side by
> > only allowing certain IP addresses to connect (or in the case I was
> > working to drop the connection if the IP is not contained in a list).
>
> This is often something better handled at the firewall. You may want to
> talk to your firewall admin to see if they can help you.
>
> > my $sock =3D new IO::Socket::INET(
> > =A0 =A0 =A0 LocalPort =3D> $port,
> > =A0 =A0 =A0 Proto =3D> 'tcp',
> > =A0 =A0 =A0 Listen =3D> SOMAXCONN,
> > =A0 =A0 =A0 Reuse =3D> 1);
> > $sock or die "no socket : $!";
>
> > if ($pid =3D fork) =A0{
> > =A0 =A0log_msg("Parent spawning child process $pid", $logfile);
> > =A0 =A0close $client;
> > } elsif (defined ($pid =3D fork)) =A0{
>
> This is not correct. You will end up forking twice, which is not what
> you meant. You want something more
>
> =A0 =A0 my $pid =3D fork;
>
> =A0 =A0 unless (defined $pid) {
> =A0 =A0 =A0 =A0 die "fork failed: $!";
> =A0 =A0 }
>
> =A0 =A0 if ($pid) {
> =A0 =A0 =A0 =A0 # parent
> =A0 =A0 }
> =A0 =A0 else {
> =A0 =A0 =A0 =A0 # child
> =A0 =A0 }
>
> > =A0 =A0if ($sock->peerhost() ne $accepted_ip) =A0{
> > =A0 =A0 =A0printf "$timestamp =A0 Connection from $accepted_ip rejected=
\n";
> > =A0 =A0 =A0close $client;
>
> > the $sock->PeerHost() is not evaluating as expected. =A0Is this used on
> > the server side? =A0how to accomplish what I want?
>
> You haven't called ->accept, so you haven't actually made a connection
> yet. ->accept returns a new socket for each connection, and it is that
> socket which has a valid ->peerhost. For example,
>
> =A0 =A0 my $S =3D IO::Socket::INET->new(
> =A0 =A0 =A0 =A0 LocalPort =3D> $port,
> =A0 =A0 =A0 =A0 Listen =A0 =A0=3D> 1,
> =A0 =A0 );
>
> =A0 =A0 my $C =3D $S->accept;
>
> =A0 =A0 warn "Got connection from " . $C->peerhost;
>
> Ben

Forgive me I actually did have the accept in before the fork as in
$client =3D $sock->accept() but when I did a

print "got a connection from $client->peerhost\n";

I get:

got a connection from IO::Socket::INET=3DGLOB(0x1c24284)->peerhost


It is not evaluating to a string, I guess, so how do I do that?


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

Date: Thu, 26 Mar 2009 08:20:14 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: logic, algorithms, and (Perl) data structures
Message-Id: <ec083bb1-3f07-4f2d-8eb5-e34085d53e1c@r36g2000vbr.googlegroups.com>

On Mar 26, 11:00=A0am, smallpond <smallp...@juno.com> wrote:
> My advice:
> 1) define the operations you want to do
> 2) lay out tables to simplify the operations
> 3) write the SQL needed to perform the operations
> 4) write the perl glue
> 5) test, test, test, test, test
> ...
> 97) worry about the efficiency of the perl code

Absolutely great advice. Two points:

3.5) write the user interface. Users must interact with the system,
and I find that writing the interface before I write the code (Perl
glue) gives me both the input and the output that I need to write the
code for.

More importantly, people can be active in different capacities in
different events, and I'm drowning in complexity. I'd like to be able
to have ONE (1) table with all my people data. The prior developers
have about ten tables representing different capacities, with the
problem that if a person's address and email changes, you've got to
chase that person over ten (worst case) different tables. My way out
is to match the incoming names against the existing names, which won't
tag duplicates but will at least tag uniques. I'll let the client sort
out the duplicates, and he understands that this isn't a software
problem.

Truthfully, this is the first application that I have been involved
with that has to track people in this way, and I'm having a problem
dealing with it. Thanks for your help.

CC



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

Date: Thu, 26 Mar 2009 10:28:02 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: logic, algorithms, and (Perl) data structures
Message-Id: <x7hc1g8fst.fsf@mail.sysarch.com>

>>>>> "c" == ccc31807  <cartercc@gmail.com> writes:

  c> I've been thinking about Schwartzian Transforms and Guttman-Rosler
  c> Transforms, and am wondering of this is the best way to handle this.
  c> I'm not concerned with real time processing since this is handled off-
  c> line, but I'd like to make it as efficient as I can.

as smallpond has said, worry about efficiency after you get it working
correctly. but in any case if you do need easier and faster sorting, use
Sort::Maker which has both. and you can select the sort style you want
and even print out the generated code for ejimication.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Thu, 26 Mar 2009 05:59:22 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: monitoring oracle rac services
Message-Id: <slrngsmo0a.cav.tadmc@tadmc30.sbcglobal.net>

alfonsobaldaserra <alfonso.baldaserra@gmail.com> wrote:
>> i need to monitor only specific services so we can pass the service
>> name as argument and check it's output.
>>
>> the problem is i cannot relate NAME with STATE to check it's current
>> state, for example, if i do
>>
>
> i guess i can load all the values in hash like
>
> NAME=ora.srv04.ASM2.asm
> TYPE=application
> TARGET=ONLINE
> STATE=ONLINE on srv04
>
> my %services = (
>    NAME => ora.srv04.ASM2.asm,
>    TYPE => application,
>    TARGET => ONLINE
>    STATE => ONLINE on srv04
> );
>
> but i still cannot figure how to relate TYPE, TARGET and STATE for
> argument NAME.


If you want to lookup by NAME, then NAME should be a hash key.

A HoH (hash of hashes, "perldoc perldsc") would seem to fit the bill:

    my %services = (
        'ora.srv04.ASM2.asm' => { TYPE   => 'application',
                                  TARGET => 'ONLINE',
                                  STATE  => 'ONLINE on srv04',
                                },
        'ora.srv99.ASM2.asm' => { TYPE   => 'application',
                                  TARGET => 'ONLINE',
                                  STATE  => 'ONLINE on srv99',
                                },
    );

    my $NAME = 'ora.srv04.ASM2.asm';
    my $state = $services{$NAME}{STATE};  # (ONLINE on srv04)


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Thu, 26 Mar 2009 12:02:08 -0700 (PDT)
From: vendion <vendion@charter.net>
Subject: Net::SSH::Perl Help
Message-Id: <1b70f485-b23e-4c55-825b-4782d6548210@f37g2000vbf.googlegroups.com>

I am trying to make a script that loops 26 times each time using SSH
to remote into a different machine every time and run a second
script.  When I run the first one with SSH I get this error:

Permission denied at /home/e-307-20/bin/upgrader.pl line 13

I know that I can SSH into the machine because SSH alone works fine.
My code is as follows (user name and password has been replaced for
security reasons)

#!/usr/bin/perl
#upgrader.pl This is the server side of a two part perl script that
uses ssh to
#get into the lab PCs and have them run the upgrade.
use warnings;
use strict;
use Net::SSH::Perl;

my $computer = '01'; #set the script for the first out of 26 computers
that use
#10.18.1.1xx ip scheme

while ($computer <= 26) {
	my $ssh = Net::SSH::Perl->new("10.18.1.1$computer");
	$ssh->login('user', 'password');
	my ($stdout, $stderr, $exit) = $ssh->cmd('upgrade.pl');
	$computer ++;
}

exit 0

Any know what I am doing wrong with the authentication with the
script?


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

Date: Thu, 26 Mar 2009 17:23:19 +0000
From: Paul Marquess <paul.marquess@btinternet.com>
Subject: Re: Sharing BerkeleyDB among forked children
Message-Id: <49cbb8e0$0$19013$4d4eb98e@read.news.uk.uu.net>

Mark wrote:

> Hello,
> 
> Using BerkeleyDB in Perl 5.8.8 BerkeleyeBSDfirstem, 

What is "BerkeleyeBSDfirstem"? 

> I am applying its tied 
> hashes inside forked children of a daemon, as a means of IPC. This works
> great, except that for every child, when it forks, I currently set the
> environment and initialize the databases, like:
> 
> if (not eval {$env = new BerkeleyDB::Env
>         -Cachesize => 16777216,
>         -Home      => '/var/db/Berkeley',
>         -Flags     => DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL}) {
>     log_error ((($_ = $BerkeleyDB::Error) ? ($_) : ($!)));
> } elsif (not eval {tie %whitelisted, 'BerkeleyDB::Hash',
> 
> ...
> 
> Etc. I wonder, is this really necessary? 

Yes, it. 

> For one, I'm thinking it wreaks 
> havoc on the Cache, as re-initializing a cache for each child seems rather
> pointless under these circumstances. 

You aren't re-initializing the cache - if there is no environment, the first
process started will create it (along with the cache). Then subsequent
processes are just joining an existing environment. The cache size they
specify matches the existing size of the cache in the environment so they
don't affect it.

> Could I not just tie these databases 
> in the parent once, and then reuse them per child? I know for MySQL
> connections this certainly goes wrong.

No, each process needs to create its own connection to the Berkeley DB
environment and any databases.
 
Paul




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

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 V11 Issue 2300
***************************************


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